From 514d7e19227555ecd9e38c642d0b7ea63d7883d2 Mon Sep 17 00:00:00 2001 From: fuxiaohei Date: Sun, 22 Jun 2014 16:53:46 +0800 Subject: [PATCH 01/23] add organization memebers page --- cmd/web.go | 1 + public/css/gogs.css | 66 +++++++++++++++++++++++++++++++++++++++++++++ routers/org/org.go | 7 ++++- 3 files changed, 73 insertions(+), 1 deletion(-) diff --git a/cmd/web.go b/cmd/web.go index f62bc2550..30e5b929a 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -190,6 +190,7 @@ func runWeb(*cli.Context) { m.Group("/o", func(r martini.Router) { r.Get("/:org", org.Organization) + r.Get("/:org/members", org.Members) }) m.Group("/:username/:reponame", func(r martini.Router) { diff --git a/public/css/gogs.css b/public/css/gogs.css index 67d1ebe58..65ec79eb2 100755 --- a/public/css/gogs.css +++ b/public/css/gogs.css @@ -1864,16 +1864,40 @@ html, body { padding: 16px 0; } +#body-nav.org-nav.org-nav-auto { + height: auto; +} + +.org-nav > .container { + padding-left: 0; + padding-left: 0; +} + .org-nav .org-logo { margin-right: 16px; width: 100px; height: 100px; } +.org-nav .org-small-logo { + margin-right: 16px; + width: 50px; + height: 50px; +} + .org-nav .org-name { margin-top: 0; } +.org-nav-auto .org-name { + font-size: 1.4em; + line-height: 48px; +} + +#body-nav.org-nav-auto .nav { + margin-top: 6px; +} + .org-description { font-size: 16px; } @@ -1894,6 +1918,10 @@ html, body { margin-left: 0; } +.org-main { + padding-left: 0; +} + .org-sidebar { margin-top: -100px; } @@ -1947,4 +1975,42 @@ html, body { .org-team a:hover .org-team-name { color: #0079bc !important; +} + +#org-members { + margin-right: 24px; +} + +#org-members .member .avatar img { + width: 50px; + height: 50px; +} + +#org-members .member { + padding-bottom: 20px; + margin-bottom: 20px; + border-bottom: 1px solid #DDD; + height: 70px; +} + +#org-members .member .name { + padding-top: 4px; +} + +#org-members .member .nick { + display: block; + color: #888; +} + +#org-members .member .name a { + color: #444; +} + +#org-members .member .name strong { + font-size: 1.2em; +} + +#org-members .status, #org-members .role { + line-height: 48px; + text-align: right; } \ No newline at end of file diff --git a/routers/org/org.go b/routers/org/org.go index 1c02e7733..69bf0fc48 100644 --- a/routers/org/org.go +++ b/routers/org/org.go @@ -6,6 +6,11 @@ import ( ) func Organization(ctx *middleware.Context, params martini.Params) { - ctx.Data["Title"] = "Organization Name" + params["org"] + ctx.Data["Title"] = "Organization " + params["org"] ctx.HTML(200, "org/org") } + +func Members(ctx *middleware.Context,params martini.Params){ + ctx.Data["Title"] = "Organization " + params["org"]+" Members" + ctx.HTML(200,"org/members") +} From adda10f4a44005880f881bcb9238b74d561f8a1b Mon Sep 17 00:00:00 2001 From: fuxiaohei Date: Sun, 22 Jun 2014 21:53:40 +0800 Subject: [PATCH 02/23] add organization teams page --- cmd/web.go | 1 + public/css/gogs.css | 36 ++++++++++++++++++++- routers/org/org.go | 6 ++++ templates/org/members.tmpl | 56 ++++++++++++++++++++++++++++++++ templates/org/teams.tmpl | 65 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 163 insertions(+), 1 deletion(-) create mode 100644 templates/org/members.tmpl create mode 100644 templates/org/teams.tmpl diff --git a/cmd/web.go b/cmd/web.go index 30e5b929a..b2521de96 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -191,6 +191,7 @@ func runWeb(*cli.Context) { m.Group("/o", func(r martini.Router) { r.Get("/:org", org.Organization) r.Get("/:org/members", org.Members) + r.Get("/:org/teams", org.Teams) }) m.Group("/:username/:reponame", func(r martini.Router) { diff --git a/public/css/gogs.css b/public/css/gogs.css index 65ec79eb2..7fdde19cc 100755 --- a/public/css/gogs.css +++ b/public/css/gogs.css @@ -1898,6 +1898,10 @@ html, body { margin-top: 6px; } +#body-nav.org-nav-auto .nav a:hover { + text-decoration: none; +} + .org-description { font-size: 16px; } @@ -1978,7 +1982,7 @@ html, body { } #org-members { - margin-right: 24px; + margin-right: 30px; } #org-members .member .avatar img { @@ -2013,4 +2017,34 @@ html, body { #org-members .status, #org-members .role { line-height: 48px; text-align: right; +} + +#org-teams .org-team .panel-heading { + margin-top: 0; +} + +#org-teams .org-team .panel-heading a { + color: #444; +} + +#org-teams .org-team-members { + margin-top: 18px; +} + +#org-teams .org-team-members img { + width: 40px; + height: 40px; + margin-right: 12px; +} + +#org-teams .org-team-members a { + display: inline-block; +} + +#org-teams .org-team .panel-footer { + height: 60px; +} + +#org-teams .org-team { + border-bottom: none; } \ No newline at end of file diff --git a/routers/org/org.go b/routers/org/org.go index 69bf0fc48..21f2a189c 100644 --- a/routers/org/org.go +++ b/routers/org/org.go @@ -14,3 +14,9 @@ func Members(ctx *middleware.Context,params martini.Params){ ctx.Data["Title"] = "Organization " + params["org"]+" Members" ctx.HTML(200,"org/members") } + +func Teams(ctx *middleware.Context,params martini.Params){ + ctx.Data["Title"] = "Organization " + params["org"]+" Teams" + ctx.HTML(200,"org/teams") +} + diff --git a/templates/org/members.tmpl b/templates/org/members.tmpl new file mode 100644 index 000000000..ba14cb4cc --- /dev/null +++ b/templates/org/members.tmpl @@ -0,0 +1,56 @@ +{{template "base/head" .}} +{{template "base/navbar" .}} +
+
+
+ + +
+

Organization Name

+
+
+ +
+
+
+
+
+
  +
+ +
+ +
+ Member +
+
+ Public +
+
+
  +
+ +
+ +
+ Owner +
+
+ Private +
+
+
+
+
+{{template "base/footer" .}} diff --git a/templates/org/teams.tmpl b/templates/org/teams.tmpl new file mode 100644 index 000000000..a8218812c --- /dev/null +++ b/templates/org/teams.tmpl @@ -0,0 +1,65 @@ +{{template "base/head" .}} +{{template "base/navbar" .}} +
+
+
+ + +
+

Organization Name

+
+
+
+
+
+
+
+
+
+

Team Name

+
+

4 members · 10 repositories

+

+ + + + + + +

+
+ +
+
+
+
+

Team Name

+
+

4 members · 10 repositories

+

+ + + + + + +

+
+ +
+
+
+
+
+{{template "base/footer" .}} From 9924e65ca11770f247723b10fcbdb81dc9534b32 Mon Sep 17 00:00:00 2001 From: Unknown Date: Sun, 22 Jun 2014 13:14:03 -0400 Subject: [PATCH 03/23] In progress of name template name constant --- modules/base/base.go | 1 + modules/mailer/mail.go | 19 ++++++-- modules/middleware/context.go | 8 ++-- routers/admin/admin.go | 27 +++++++---- routers/admin/{auths.go => auth.go} | 23 +++++---- routers/admin/user.go | 48 +++++++++++-------- routers/dashboard.go | 7 ++- routers/dev/template.go | 3 +- routers/install.go | 26 ++++++---- routers/repo/repo.go | 2 +- templates/admin/{auths => auth}/edit.tmpl | 0 templates/admin/{auths => auth}/new.tmpl | 0 templates/admin/{users => user}/edit.tmpl | 0 templates/admin/{users => user}/new.tmpl | 0 .../auth/{active_email.tmpl => active.tmpl} | 0 templates/{ => repo}/issue/create.tmpl | 0 templates/{ => repo}/issue/list.tmpl | 0 templates/{ => repo}/issue/milestone.tmpl | 0 .../{ => repo}/issue/milestone_edit.tmpl | 0 templates/{ => repo}/issue/milestone_new.tmpl | 0 templates/{ => repo}/issue/view.tmpl | 0 templates/{ => repo}/release/edit.tmpl | 0 templates/{ => repo}/release/list.tmpl | 0 templates/{ => repo}/release/new.tmpl | 0 24 files changed, 104 insertions(+), 60 deletions(-) rename routers/admin/{auths.go => auth.go} (89%) rename templates/admin/{auths => auth}/edit.tmpl (100%) rename templates/admin/{auths => auth}/new.tmpl (100%) rename templates/admin/{users => user}/edit.tmpl (100%) rename templates/admin/{users => user}/new.tmpl (100%) rename templates/mail/auth/{active_email.tmpl => active.tmpl} (100%) rename templates/{ => repo}/issue/create.tmpl (100%) rename templates/{ => repo}/issue/list.tmpl (100%) rename templates/{ => repo}/issue/milestone.tmpl (100%) rename templates/{ => repo}/issue/milestone_edit.tmpl (100%) rename templates/{ => repo}/issue/milestone_new.tmpl (100%) rename templates/{ => repo}/issue/view.tmpl (100%) rename templates/{ => repo}/release/edit.tmpl (100%) rename templates/{ => repo}/release/list.tmpl (100%) rename templates/{ => repo}/release/new.tmpl (100%) diff --git a/modules/base/base.go b/modules/base/base.go index 145fae6f1..570600c3d 100644 --- a/modules/base/base.go +++ b/modules/base/base.go @@ -7,6 +7,7 @@ package base type ( // Type TmplData represents data in the templates. TmplData map[string]interface{} + TplName string ApiJsonErr struct { Message string `json:"message"` diff --git a/modules/mailer/mail.go b/modules/mailer/mail.go index e212d0066..62e15cd7f 100644 --- a/modules/mailer/mail.go +++ b/modules/mailer/mail.go @@ -17,6 +17,15 @@ import ( "github.com/gogits/gogs/modules/setting" ) +const ( + AUTH_ACTIVE base.TplName = "mail/auth/active" + AUTH_REGISTER_SUCCESS base.TplName = "mail/auth/register_success" + AUTH_RESET_PASSWORD base.TplName = "mail/auth/reset_passwd" + + NOTIFY_COLLABORATOR base.TplName = "mail/notify/collaborator" + NOTIFY_MENTION base.TplName = "mail/notify/mention" +) + // Create New mail message use MailFrom and MailUser func NewMailMessageFrom(To []string, from, subject, body string) Message { msg := NewHtmlMessage(To, from, subject, body) @@ -61,7 +70,7 @@ func SendRegisterMail(r *middleware.Render, u *models.User) { data := GetMailTmplData(u) data["Code"] = code - body, err := r.HTMLString("mail/auth/register_success", data) + body, err := r.HTMLString(string(AUTH_REGISTER_SUCCESS), data) if err != nil { log.Error("mail.SendRegisterMail(fail to render): %v", err) return @@ -81,7 +90,7 @@ func SendActiveMail(r *middleware.Render, u *models.User) { data := GetMailTmplData(u) data["Code"] = code - body, err := r.HTMLString("mail/auth/active_email", data) + body, err := r.HTMLString(string(AUTH_ACTIVE), data) if err != nil { log.Error("mail.SendActiveMail(fail to render): %v", err) return @@ -101,7 +110,7 @@ func SendResetPasswdMail(r *middleware.Render, u *models.User) { data := GetMailTmplData(u) data["Code"] = code - body, err := r.HTMLString("mail/auth/reset_passwd", data) + body, err := r.HTMLString(string(AUTH_RESET_PASSWORD), data) if err != nil { log.Error("mail.SendResetPasswdMail(fail to render): %v", err) return @@ -161,7 +170,7 @@ func SendIssueMentionMail(r *middleware.Render, u, owner *models.User, data["IssueLink"] = fmt.Sprintf("%s/%s/issues/%d", owner.Name, repo.Name, issue.Index) data["Subject"] = subject - body, err := r.HTMLString("mail/notify/mention", data) + body, err := r.HTMLString(string(NOTIFY_MENTION), data) if err != nil { return fmt.Errorf("mail.SendIssueMentionMail(fail to render): %v", err) } @@ -182,7 +191,7 @@ func SendCollaboratorMail(r *middleware.Render, u, owner *models.User, data["RepoLink"] = path.Join(owner.Name, repo.Name) data["Subject"] = subject - body, err := r.HTMLString("mail/notify/collaborator", data) + body, err := r.HTMLString(string(NOTIFY_COLLABORATOR), data) if err != nil { return fmt.Errorf("mail.SendCollaboratorMail(fail to render): %v", err) } diff --git a/modules/middleware/context.go b/modules/middleware/context.go index 19556118e..45f0140a2 100644 --- a/modules/middleware/context.go +++ b/modules/middleware/context.go @@ -104,12 +104,12 @@ func (ctx *Context) HasError() bool { } // HTML calls render.HTML underlying but reduce one argument. -func (ctx *Context) HTML(status int, name string, htmlOpt ...HTMLOptions) { - ctx.Render.HTML(status, name, ctx.Data, htmlOpt...) +func (ctx *Context) HTML(status int, name base.TplName, htmlOpt ...HTMLOptions) { + ctx.Render.HTML(status, string(name), ctx.Data, htmlOpt...) } // RenderWithErr used for page has form validation but need to prompt error to users. -func (ctx *Context) RenderWithErr(msg, tpl string, form auth.Form) { +func (ctx *Context) RenderWithErr(msg string, tpl base.TplName, form auth.Form) { if form != nil { auth.AssignForm(form, ctx.Data) } @@ -133,7 +133,7 @@ func (ctx *Context) Handle(status int, title string, err error) { case 500: ctx.Data["Title"] = "Internal Server Error" } - ctx.HTML(status, fmt.Sprintf("status/%d", status)) + ctx.HTML(status, base.TplName(fmt.Sprintf("status/%d", status))) } func (ctx *Context) Debug(msg string, args ...interface{}) { diff --git a/routers/admin/admin.go b/routers/admin/admin.go index 1567a3001..140e1e9f6 100644 --- a/routers/admin/admin.go +++ b/routers/admin/admin.go @@ -20,6 +20,16 @@ import ( "github.com/gogits/gogs/modules/setting" ) +const ( + DASHBOARD base.TplName = "admin/dashboard" + USERS base.TplName = "admin/users" + REPOS base.TplName = "admin/repos" + AUTHS base.TplName = "admin/auths" + CONFIG base.TplName = "admin/config" + MONITOR_PROCESS base.TplName = "admin/monitor/process" + MONITOR_CRON base.TplName = "admin/monitor/cron" +) + var startTime = time.Now() var sysStatus struct { @@ -140,7 +150,7 @@ func Dashboard(ctx *middleware.Context) { ctx.Data["Stats"] = models.GetStatistic() updateSystemStatus() ctx.Data["SysStatus"] = sysStatus - ctx.HTML(200, "admin/dashboard") + ctx.HTML(200, DASHBOARD) } func Users(ctx *middleware.Context) { @@ -150,10 +160,10 @@ func Users(ctx *middleware.Context) { var err error ctx.Data["Users"], err = models.GetUsers(200, 0) if err != nil { - ctx.Handle(500, "admin.Users", err) + ctx.Handle(500, "admin.Users(GetUsers)", err) return } - ctx.HTML(200, "admin/users") + ctx.HTML(200, USERS) } func Repositories(ctx *middleware.Context) { @@ -166,7 +176,7 @@ func Repositories(ctx *middleware.Context) { ctx.Handle(500, "admin.Repositories", err) return } - ctx.HTML(200, "admin/repos") + ctx.HTML(200, REPOS) } func Auths(ctx *middleware.Context) { @@ -179,7 +189,7 @@ func Auths(ctx *middleware.Context) { ctx.Handle(500, "admin.Auths", err) return } - ctx.HTML(200, "admin/auths") + ctx.HTML(200, AUTHS) } func Config(ctx *middleware.Context) { @@ -235,7 +245,7 @@ func Config(ctx *middleware.Context) { } ctx.Data["Loggers"] = loggers - ctx.HTML(200, "admin/config") + ctx.HTML(200, CONFIG) } func Monitor(ctx *middleware.Context) { @@ -247,11 +257,10 @@ func Monitor(ctx *middleware.Context) { case "process": ctx.Data["PageIsMonitorProcess"] = true ctx.Data["Processes"] = process.Processes - ctx.HTML(200, "admin/monitor/process") + ctx.HTML(200, MONITOR_PROCESS) default: ctx.Data["PageIsMonitorCron"] = true ctx.Data["Entries"] = cron.ListEntries() - ctx.HTML(200, "admin/monitor/cron") + ctx.HTML(200, MONITOR_CRON) } - } diff --git a/routers/admin/auths.go b/routers/admin/auth.go similarity index 89% rename from routers/admin/auths.go rename to routers/admin/auth.go index e0b997148..ff6c0325b 100644 --- a/routers/admin/auths.go +++ b/routers/admin/auth.go @@ -18,12 +18,17 @@ import ( "github.com/gogits/gogs/modules/middleware" ) +const ( + AUTH_NEW base.TplName = "admin/auth/new" + AUTH_EDIT base.TplName = "admin/auth/edit" +) + func NewAuthSource(ctx *middleware.Context) { ctx.Data["Title"] = "New Authentication" ctx.Data["PageIsAuths"] = true ctx.Data["LoginTypes"] = models.LoginTypes ctx.Data["SMTPAuths"] = models.SMTPAuths - ctx.HTML(200, "admin/auths/new") + ctx.HTML(200, AUTH_NEW) } func NewAuthSourcePost(ctx *middleware.Context, form auth.AuthenticationForm) { @@ -33,7 +38,7 @@ func NewAuthSourcePost(ctx *middleware.Context, form auth.AuthenticationForm) { ctx.Data["SMTPAuths"] = models.SMTPAuths if ctx.HasError() { - ctx.HTML(200, "admin/auths/new") + ctx.HTML(200, AUTH_NEW) return } @@ -74,7 +79,7 @@ func NewAuthSourcePost(ctx *middleware.Context, form auth.AuthenticationForm) { } if err := models.CreateSource(source); err != nil { - ctx.Handle(500, "admin.auths.NewAuth", err) + ctx.Handle(500, "admin.auths.NewAuth(CreateSource)", err) return } @@ -97,11 +102,11 @@ func EditAuthSource(ctx *middleware.Context, params martini.Params) { } u, err := models.GetLoginSourceById(id) if err != nil { - ctx.Handle(500, "admin.user.EditUser", err) + ctx.Handle(500, "admin.user.EditUser(GetLoginSourceById)", err) return } ctx.Data["Source"] = u - ctx.HTML(200, "admin/auths/edit") + ctx.HTML(200, AUTH_EDIT) } func EditAuthSourcePost(ctx *middleware.Context, form auth.AuthenticationForm) { @@ -111,7 +116,7 @@ func EditAuthSourcePost(ctx *middleware.Context, form auth.AuthenticationForm) { ctx.Data["SMTPAuths"] = models.SMTPAuths if ctx.HasError() { - ctx.HTML(200, "admin/auths/edit") + ctx.HTML(200, AUTH_EDIT) return } @@ -153,7 +158,7 @@ func EditAuthSourcePost(ctx *middleware.Context, form auth.AuthenticationForm) { } if err := models.UpdateSource(&u); err != nil { - ctx.Handle(500, "admin.auths.EditAuth", err) + ctx.Handle(500, "admin.auths.EditAuth(UpdateSource)", err) return } @@ -175,7 +180,7 @@ func DeleteAuthSource(ctx *middleware.Context, params martini.Params) { a, err := models.GetLoginSourceById(id) if err != nil { - ctx.Handle(500, "admin.auths.DeleteAuth", err) + ctx.Handle(500, "admin.auths.DeleteAuth(GetLoginSourceById)", err) return } @@ -185,7 +190,7 @@ func DeleteAuthSource(ctx *middleware.Context, params martini.Params) { ctx.Flash.Error("This authentication still has used by some users, you should move them and then delete again.") ctx.Redirect("/admin/auths/" + params["authid"]) default: - ctx.Handle(500, "admin.auths.DeleteAuth", err) + ctx.Handle(500, "admin.auths.DeleteAuth(DelLoginSource)", err) } return } diff --git a/routers/admin/user.go b/routers/admin/user.go index 596fe7b1d..d1bbb4806 100644 --- a/routers/admin/user.go +++ b/routers/admin/user.go @@ -5,8 +5,6 @@ package admin import ( - "fmt" - "strconv" "strings" "github.com/go-martini/martini" @@ -18,16 +16,21 @@ import ( "github.com/gogits/gogs/modules/middleware" ) +const ( + USER_NEW base.TplName = "admin/user/new" + USER_EDIT base.TplName = "admin/user/edit" +) + func NewUser(ctx *middleware.Context) { ctx.Data["Title"] = "New Account" ctx.Data["PageIsUsers"] = true auths, err := models.GetAuths() if err != nil { - ctx.Handle(500, "admin.user.NewUser", err) + ctx.Handle(500, "admin.user.NewUser(GetAuths)", err) return } ctx.Data["LoginSources"] = auths - ctx.HTML(200, "admin/users/new") + ctx.HTML(200, USER_NEW) } func NewUserPost(ctx *middleware.Context, form auth.RegisterForm) { @@ -35,7 +38,7 @@ func NewUserPost(ctx *middleware.Context, form auth.RegisterForm) { ctx.Data["PageIsUsers"] = true if ctx.HasError() { - ctx.HTML(200, "admin/users/new") + ctx.HTML(200, USER_NEW) return } @@ -55,25 +58,25 @@ func NewUserPost(ctx *middleware.Context, form auth.RegisterForm) { } if len(form.LoginType) > 0 { + // NOTE: need rewrite. fields := strings.Split(form.LoginType, "-") - tp, _ := strconv.Atoi(fields[0]) + tp, _ := base.StrTo(fields[0]).Int() u.LoginType = models.LoginType(tp) - u.LoginSource, _ = strconv.ParseInt(fields[1], 10, 64) + u.LoginSource, _ = base.StrTo(fields[1]).Int64() u.LoginName = form.LoginName - fmt.Println(u.LoginType, u.LoginSource, u.LoginName) } var err error if u, err = models.RegisterUser(u); err != nil { switch err { case models.ErrUserAlreadyExist: - ctx.RenderWithErr("Username has been already taken", "admin/users/new", &form) + ctx.RenderWithErr("Username has been already taken", USER_NEW, &form) case models.ErrEmailAlreadyUsed: - ctx.RenderWithErr("E-mail address has been already used", "admin/users/new", &form) + ctx.RenderWithErr("E-mail address has been already used", USER_NEW, &form) case models.ErrUserNameIllegal: - ctx.RenderWithErr(models.ErrRepoNameIllegal.Error(), "admin/users/new", &form) + ctx.RenderWithErr(models.ErrRepoNameIllegal.Error(), USER_NEW, &form) default: - ctx.Handle(500, "admin.user.NewUser", err) + ctx.Handle(500, "admin.user.NewUser(RegisterUser)", err) } return } @@ -96,18 +99,18 @@ func EditUser(ctx *middleware.Context, params martini.Params) { u, err := models.GetUserById(int64(uid)) if err != nil { - ctx.Handle(500, "admin.user.EditUser", err) + ctx.Handle(500, "admin.user.EditUser(GetUserById)", err) return } ctx.Data["User"] = u auths, err := models.GetAuths() if err != nil { - ctx.Handle(500, "admin.user.NewUser", err) + ctx.Handle(500, "admin.user.NewUser(GetAuths)", err) return } ctx.Data["LoginSources"] = auths - ctx.HTML(200, "admin/users/edit") + ctx.HTML(200, USER_EDIT) } func EditUserPost(ctx *middleware.Context, params martini.Params, form auth.AdminEditUserForm) { @@ -116,13 +119,18 @@ func EditUserPost(ctx *middleware.Context, params martini.Params, form auth.Admi uid, err := base.StrTo(params["userid"]).Int() if err != nil { - ctx.Handle(404, "admin.user.EditUser", err) + ctx.Handle(404, "admin.user.EditUserPost", err) return } u, err := models.GetUserById(int64(uid)) if err != nil { - ctx.Handle(500, "admin.user.EditUser", err) + ctx.Handle(500, "admin.user.EditUserPost(GetUserById)", err) + return + } + + if ctx.HasError() { + ctx.HTML(200, USER_EDIT) return } @@ -134,7 +142,7 @@ func EditUserPost(ctx *middleware.Context, params martini.Params, form auth.Admi u.IsActive = form.Active u.IsAdmin = form.Admin if err := models.UpdateUser(u); err != nil { - ctx.Handle(500, "admin.user.EditUser", err) + ctx.Handle(500, "admin.user.EditUserPost(UpdateUser)", err) return } log.Trace("%s User profile updated by admin(%s): %s", ctx.Req.RequestURI, @@ -152,13 +160,13 @@ func DeleteUser(ctx *middleware.Context, params martini.Params) { //log.Info("delete") uid, err := base.StrTo(params["userid"]).Int() if err != nil { - ctx.Handle(404, "admin.user.EditUser", err) + ctx.Handle(404, "admin.user.DeleteUser", err) return } u, err := models.GetUserById(int64(uid)) if err != nil { - ctx.Handle(500, "admin.user.EditUser", err) + ctx.Handle(500, "admin.user.DeleteUser(GetUserById)", err) return } diff --git a/routers/dashboard.go b/routers/dashboard.go index 438d03794..d65c403c5 100644 --- a/routers/dashboard.go +++ b/routers/dashboard.go @@ -6,11 +6,16 @@ package routers import ( "github.com/gogits/gogs/models" + "github.com/gogits/gogs/modules/base" "github.com/gogits/gogs/modules/middleware" "github.com/gogits/gogs/modules/setting" "github.com/gogits/gogs/routers/user" ) +const ( + HOME base.TplName = "home" +) + func Home(ctx *middleware.Context) { if ctx.IsSigned { user.Dashboard(ctx) @@ -40,7 +45,7 @@ func Home(ctx *middleware.Context) { } } ctx.Data["Repos"] = repos - ctx.HTML(200, "home") + ctx.HTML(200, HOME) } func NotFound(ctx *middleware.Context) { diff --git a/routers/dev/template.go b/routers/dev/template.go index 5e84d76ed..da477c94c 100644 --- a/routers/dev/template.go +++ b/routers/dev/template.go @@ -8,6 +8,7 @@ import ( "github.com/go-martini/martini" "github.com/gogits/gogs/models" + "github.com/gogits/gogs/modules/base" "github.com/gogits/gogs/modules/middleware" "github.com/gogits/gogs/modules/setting" ) @@ -22,5 +23,5 @@ func TemplatePreview(ctx *middleware.Context, params martini.Params) { ctx.Data["ActiveCodeLives"] = setting.Service.ActiveCodeLives / 60 ctx.Data["ResetPwdCodeLives"] = setting.Service.ResetPwdCodeLives / 60 ctx.Data["CurDbValue"] = "" - ctx.HTML(200, params["_1"]) + ctx.HTML(200, base.TplName(params["_1"])) } diff --git a/routers/install.go b/routers/install.go index c2eee88a5..6ce7c9802 100644 --- a/routers/install.go +++ b/routers/install.go @@ -26,6 +26,10 @@ import ( "github.com/gogits/gogs/modules/social" ) +const ( + INSTALL base.TplName = "install" +) + func checkRunMode() { switch setting.Cfg.MustValue("", "RUN_MODE") { case "prod": @@ -72,6 +76,7 @@ func renderDbOption(ctx *middleware.Context) { ctx.Data["DbOptions"] = []string{"MySQL", "PostgreSQL", "SQLite3"} } +// @router /install [get] func Install(ctx *middleware.Context, form auth.InstallForm) { if setting.InstallLock { ctx.Handle(404, "install.Install", errors.New("Installation is prohibited")) @@ -119,12 +124,12 @@ func Install(ctx *middleware.Context, form auth.InstallForm) { ctx.Data["CurDbOption"] = curDbOp auth.AssignForm(form, ctx.Data) - ctx.HTML(200, "install") + ctx.HTML(200, INSTALL) } func InstallPost(ctx *middleware.Context, form auth.InstallForm) { if setting.InstallLock { - ctx.Handle(404, "install.Install", errors.New("Installation is prohibited")) + ctx.Handle(404, "install.InstallPost", errors.New("Installation is prohibited")) return } @@ -135,12 +140,12 @@ func InstallPost(ctx *middleware.Context, form auth.InstallForm) { ctx.Data["CurDbOption"] = form.Database if ctx.HasError() { - ctx.HTML(200, "install") + ctx.HTML(200, INSTALL) return } if _, err := exec.LookPath("git"); err != nil { - ctx.RenderWithErr("Fail to test 'git' command: "+err.Error(), "install", &form) + ctx.RenderWithErr("Fail to test 'git' command: "+err.Error(), INSTALL, &form) return } @@ -158,18 +163,19 @@ func InstallPost(ctx *middleware.Context, form auth.InstallForm) { // Set test engine. var x *xorm.Engine if err := models.NewTestEngine(x); err != nil { + // NOTE: should use core.QueryDriver (github.com/go-xorm/core) if strings.Contains(err.Error(), `Unknown database type: sqlite3`) { ctx.RenderWithErr("Your release version does not support SQLite3, please download the official binary version "+ - "from http://gogs.io/docs/installation/install_from_binary.md, NOT the gobuild version.", "install", &form) + "from http://gogs.io/docs/installation/install_from_binary.md, NOT the gobuild version.", INSTALL, &form) } else { - ctx.RenderWithErr("Database setting is not correct: "+err.Error(), "install", &form) + ctx.RenderWithErr("Database setting is not correct: "+err.Error(), INSTALL, &form) } return } // Test repository root path. if err := os.MkdirAll(form.RepoRootPath, os.ModePerm); err != nil { - ctx.RenderWithErr("Repository root path is invalid: "+err.Error(), "install", &form) + ctx.RenderWithErr("Repository root path is invalid: "+err.Error(), INSTALL, &form) return } @@ -180,7 +186,7 @@ func InstallPost(ctx *middleware.Context, form auth.InstallForm) { } // Does not check run user when the install lock is off. if form.RunUser != curUser { - ctx.RenderWithErr("Run user isn't the current user: "+form.RunUser+" -> "+curUser, "install", &form) + ctx.RenderWithErr("Run user isn't the current user: "+form.RunUser+" -> "+curUser, INSTALL, &form) return } @@ -214,7 +220,7 @@ func InstallPost(ctx *middleware.Context, form auth.InstallForm) { os.MkdirAll("custom/conf", os.ModePerm) if err := goconfig.SaveConfigFile(setting.Cfg, path.Join(setting.CustomPath, "conf/app.ini")); err != nil { - ctx.RenderWithErr("Fail to save configuration: "+err.Error(), "install", &form) + ctx.RenderWithErr("Fail to save configuration: "+err.Error(), INSTALL, &form) return } @@ -225,7 +231,7 @@ func InstallPost(ctx *middleware.Context, form auth.InstallForm) { IsAdmin: true, IsActive: true}); err != nil { if err != models.ErrUserAlreadyExist { setting.InstallLock = false - ctx.RenderWithErr("Admin account setting is invalid: "+err.Error(), "install", &form) + ctx.RenderWithErr("Admin account setting is invalid: "+err.Error(), INSTALL, &form) return } log.Info("Admin account already exist") diff --git a/routers/repo/repo.go b/routers/repo/repo.go index 6db453007..6154eede3 100644 --- a/routers/repo/repo.go +++ b/routers/repo/repo.go @@ -318,7 +318,7 @@ func basicDecode(encoded string) (user string, name string, err error) { func authRequired(ctx *middleware.Context) { ctx.ResponseWriter.Header().Set("WWW-Authenticate", "Basic realm=\".\"") ctx.Data["ErrorMsg"] = "no basic auth and digit auth" - ctx.HTML(401, fmt.Sprintf("status/401")) + ctx.HTML(401, base.TplName("status/401")) } func Action(ctx *middleware.Context, params martini.Params) { diff --git a/templates/admin/auths/edit.tmpl b/templates/admin/auth/edit.tmpl similarity index 100% rename from templates/admin/auths/edit.tmpl rename to templates/admin/auth/edit.tmpl diff --git a/templates/admin/auths/new.tmpl b/templates/admin/auth/new.tmpl similarity index 100% rename from templates/admin/auths/new.tmpl rename to templates/admin/auth/new.tmpl diff --git a/templates/admin/users/edit.tmpl b/templates/admin/user/edit.tmpl similarity index 100% rename from templates/admin/users/edit.tmpl rename to templates/admin/user/edit.tmpl diff --git a/templates/admin/users/new.tmpl b/templates/admin/user/new.tmpl similarity index 100% rename from templates/admin/users/new.tmpl rename to templates/admin/user/new.tmpl diff --git a/templates/mail/auth/active_email.tmpl b/templates/mail/auth/active.tmpl similarity index 100% rename from templates/mail/auth/active_email.tmpl rename to templates/mail/auth/active.tmpl diff --git a/templates/issue/create.tmpl b/templates/repo/issue/create.tmpl similarity index 100% rename from templates/issue/create.tmpl rename to templates/repo/issue/create.tmpl diff --git a/templates/issue/list.tmpl b/templates/repo/issue/list.tmpl similarity index 100% rename from templates/issue/list.tmpl rename to templates/repo/issue/list.tmpl diff --git a/templates/issue/milestone.tmpl b/templates/repo/issue/milestone.tmpl similarity index 100% rename from templates/issue/milestone.tmpl rename to templates/repo/issue/milestone.tmpl diff --git a/templates/issue/milestone_edit.tmpl b/templates/repo/issue/milestone_edit.tmpl similarity index 100% rename from templates/issue/milestone_edit.tmpl rename to templates/repo/issue/milestone_edit.tmpl diff --git a/templates/issue/milestone_new.tmpl b/templates/repo/issue/milestone_new.tmpl similarity index 100% rename from templates/issue/milestone_new.tmpl rename to templates/repo/issue/milestone_new.tmpl diff --git a/templates/issue/view.tmpl b/templates/repo/issue/view.tmpl similarity index 100% rename from templates/issue/view.tmpl rename to templates/repo/issue/view.tmpl diff --git a/templates/release/edit.tmpl b/templates/repo/release/edit.tmpl similarity index 100% rename from templates/release/edit.tmpl rename to templates/repo/release/edit.tmpl diff --git a/templates/release/list.tmpl b/templates/repo/release/list.tmpl similarity index 100% rename from templates/release/list.tmpl rename to templates/repo/release/list.tmpl diff --git a/templates/release/new.tmpl b/templates/repo/release/new.tmpl similarity index 100% rename from templates/release/new.tmpl rename to templates/repo/release/new.tmpl From 314193029a246c2498c6d54c085d57f7589c8dbe Mon Sep 17 00:00:00 2001 From: Unknown Date: Sun, 22 Jun 2014 23:11:12 -0400 Subject: [PATCH 04/23] Use constants to name template file --- gogs.go | 2 +- routers/repo/branch.go | 11 ++- routers/repo/commit.go | 92 ++++++++++--------- routers/repo/issue.go | 34 +++++-- routers/repo/pull.go | 7 +- routers/repo/release.go | 19 +++- routers/repo/repo.go | 30 +++--- routers/repo/setting.go | 67 ++++++++------ routers/user/home.go | 18 +++- routers/user/setting.go | 25 +++-- routers/user/user.go | 53 ++++++----- templates/VERSION | 2 +- templates/repo/{branches.tmpl => branch.tmpl} | 0 .../repo/{hooks_add.tmpl => hook_add.tmpl} | 0 .../repo/{hooks_edit.tmpl => hook_edit.tmpl} | 0 templates/user/{issue.tmpl => issues.tmpl} | 0 16 files changed, 226 insertions(+), 134 deletions(-) rename templates/repo/{branches.tmpl => branch.tmpl} (100%) rename templates/repo/{hooks_add.tmpl => hook_add.tmpl} (100%) rename templates/repo/{hooks_edit.tmpl => hook_edit.tmpl} (100%) rename templates/user/{issue.tmpl => issues.tmpl} (100%) diff --git a/gogs.go b/gogs.go index 7719ee0af..03c286016 100644 --- a/gogs.go +++ b/gogs.go @@ -17,7 +17,7 @@ import ( "github.com/gogits/gogs/modules/setting" ) -const APP_VER = "0.4.5.0621 Alpha" +const APP_VER = "0.4.5.0622 Alpha" func init() { runtime.GOMAXPROCS(runtime.NumCPU()) diff --git a/routers/repo/branch.go b/routers/repo/branch.go index 2e2ae6925..9bad7289b 100644 --- a/routers/repo/branch.go +++ b/routers/repo/branch.go @@ -7,22 +7,27 @@ package repo import ( "github.com/go-martini/martini" + "github.com/gogits/gogs/modules/base" "github.com/gogits/gogs/modules/middleware" ) +const ( + BRANCH base.TplName = "repo/branch" +) + func Branches(ctx *middleware.Context, params martini.Params) { ctx.Data["Title"] = "Branches" ctx.Data["IsRepoToolbarBranches"] = true brs, err := ctx.Repo.GitRepo.GetBranches() if err != nil { - ctx.Handle(500, "repo.Branches", err) + ctx.Handle(500, "repo.Branches(GetBranches)", err) return } else if len(brs) == 0 { - ctx.Handle(404, "repo.Branches", nil) + ctx.Handle(404, "repo.Branches(GetBranches)", nil) return } ctx.Data["Branches"] = brs - ctx.HTML(200, "repo/branches") + ctx.HTML(200, BRANCH) } diff --git a/routers/repo/commit.go b/routers/repo/commit.go index 09dcaf5ea..aa5c22e41 100644 --- a/routers/repo/commit.go +++ b/routers/repo/commit.go @@ -14,6 +14,11 @@ import ( "github.com/gogits/gogs/modules/middleware" ) +const ( + COMMITS base.TplName = "repo/commits" + DIFF base.TplName = "repo/diff" +) + func Commits(ctx *middleware.Context, params martini.Params) { ctx.Data["IsRepoToolbarCommits"] = true @@ -22,10 +27,10 @@ func Commits(ctx *middleware.Context, params martini.Params) { brs, err := ctx.Repo.GitRepo.GetBranches() if err != nil { - ctx.Handle(500, "repo.Commits", err) + ctx.Handle(500, "repo.Commits(GetBranches)", err) return } else if len(brs) == 0 { - ctx.Handle(404, "repo.Commits", nil) + ctx.Handle(404, "repo.Commits(GetBranches)", nil) return } @@ -61,7 +66,43 @@ func Commits(ctx *middleware.Context, params martini.Params) { ctx.Data["CommitCount"] = commitsCount ctx.Data["LastPageNum"] = lastPage ctx.Data["NextPageNum"] = nextPage - ctx.HTML(200, "repo/commits") + ctx.HTML(200, COMMITS) +} + +func SearchCommits(ctx *middleware.Context, params martini.Params) { + ctx.Data["IsSearchPage"] = true + ctx.Data["IsRepoToolbarCommits"] = true + + keyword := ctx.Query("q") + if len(keyword) == 0 { + ctx.Redirect(ctx.Repo.RepoLink + "/commits/" + ctx.Repo.BranchName) + return + } + + userName := params["username"] + repoName := params["reponame"] + + brs, err := ctx.Repo.GitRepo.GetBranches() + if err != nil { + ctx.Handle(500, "repo.SearchCommits(GetBranches)", err) + return + } else if len(brs) == 0 { + ctx.Handle(404, "repo.SearchCommits(GetBranches)", nil) + return + } + + commits, err := ctx.Repo.Commit.SearchCommits(keyword) + if err != nil { + ctx.Handle(500, "repo.SearchCommits(SearchCommits)", err) + return + } + + ctx.Data["Keyword"] = keyword + ctx.Data["Username"] = userName + ctx.Data["Reponame"] = repoName + ctx.Data["CommitCount"] = commits.Len() + ctx.Data["Commits"] = commits + ctx.HTML(200, COMMITS) } func Diff(ctx *middleware.Context, params martini.Params) { @@ -75,7 +116,7 @@ func Diff(ctx *middleware.Context, params martini.Params) { diff, err := models.GetDiff(models.RepoPath(userName, repoName), commitId) if err != nil { - ctx.Handle(404, "repo.Diff", err) + ctx.Handle(404, "repo.Diff(GetDiff)", err) return } @@ -119,43 +160,7 @@ func Diff(ctx *middleware.Context, params martini.Params) { ctx.Data["DiffNotAvailable"] = diff.NumFiles() == 0 ctx.Data["SourcePath"] = "/" + path.Join(userName, repoName, "src", commitId) ctx.Data["RawPath"] = "/" + path.Join(userName, repoName, "raw", commitId) - ctx.HTML(200, "repo/diff") -} - -func SearchCommits(ctx *middleware.Context, params martini.Params) { - ctx.Data["IsSearchPage"] = true - ctx.Data["IsRepoToolbarCommits"] = true - - keyword := ctx.Query("q") - if len(keyword) == 0 { - ctx.Redirect(ctx.Repo.RepoLink + "/commits/" + ctx.Repo.BranchName) - return - } - - userName := params["username"] - repoName := params["reponame"] - - brs, err := ctx.Repo.GitRepo.GetBranches() - if err != nil { - ctx.Handle(500, "repo.SearchCommits(GetBranches)", err) - return - } else if len(brs) == 0 { - ctx.Handle(404, "repo.SearchCommits(GetBranches)", nil) - return - } - - commits, err := ctx.Repo.Commit.SearchCommits(keyword) - if err != nil { - ctx.Handle(500, "repo.SearchCommits(SearchCommits)", err) - return - } - - ctx.Data["Keyword"] = keyword - ctx.Data["Username"] = userName - ctx.Data["Reponame"] = repoName - ctx.Data["CommitCount"] = commits.Len() - ctx.Data["Commits"] = commits - ctx.HTML(200, "repo/commits") + ctx.HTML(200, DIFF) } func FileHistory(ctx *middleware.Context, params martini.Params) { @@ -184,8 +189,7 @@ func FileHistory(ctx *middleware.Context, params martini.Params) { if err != nil { ctx.Handle(500, "repo.FileHistory(GetCommitsCount)", err) return - } - if commitsCount == 0 { + } else if commitsCount == 0 { ctx.Handle(404, "repo.FileHistory", nil) return } @@ -217,5 +221,5 @@ func FileHistory(ctx *middleware.Context, params martini.Params) { ctx.Data["CommitCount"] = commitsCount ctx.Data["LastPageNum"] = lastPage ctx.Data["NextPageNum"] = nextPage - ctx.HTML(200, "repo/commits") + ctx.HTML(200, COMMITS) } diff --git a/routers/repo/issue.go b/routers/repo/issue.go index 11c573f5c..cf454bc8f 100644 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -22,6 +22,16 @@ import ( "github.com/gogits/gogs/modules/setting" ) +const ( + ISSUES base.TplName = "repo/issue/list" + ISSUE_CREATE base.TplName = "repo/issue/create" + ISSUE_VIEW base.TplName = "repo/issue/view" + + MILESTONE base.TplName = "repo/issue/milestone" + MILESTONE_NEW base.TplName = "repo/issue/milestone_new" + MILESTONE_EDIT base.TplName = "repo/issue/milestone_edit" +) + func Issues(ctx *middleware.Context) { ctx.Data["Title"] = "Issues" ctx.Data["IsRepoToolbarIssues"] = true @@ -134,7 +144,7 @@ func Issues(ctx *middleware.Context) { } else { ctx.Data["ShowCount"] = issueStats.OpenCount } - ctx.HTML(200, "issue/list") + ctx.HTML(200, ISSUES) } func CreateIssue(ctx *middleware.Context, params martini.Params) { @@ -161,7 +171,7 @@ func CreateIssue(ctx *middleware.Context, params martini.Params) { return } ctx.Data["Collaborators"] = us - ctx.HTML(200, "issue/create") + ctx.HTML(200, ISSUE_CREATE) } func CreateIssuePost(ctx *middleware.Context, params martini.Params, form auth.CreateIssueForm) { @@ -190,7 +200,7 @@ func CreateIssuePost(ctx *middleware.Context, params martini.Params, form auth.C ctx.Data["Collaborators"] = us if ctx.HasError() { - ctx.HTML(200, "issue/create") + ctx.HTML(200, ISSUE_CREATE) return } @@ -392,7 +402,7 @@ func ViewIssue(ctx *middleware.Context, params martini.Params) { ctx.Data["IsIssueOwner"] = ctx.Repo.IsOwner || (ctx.IsSigned && issue.PosterId == ctx.User.Id) ctx.Data["IsRepoToolbarIssues"] = true ctx.Data["IsRepoToolbarIssuesList"] = false - ctx.HTML(200, "issue/view") + ctx.HTML(200, ISSUE_VIEW) } func UpdateIssue(ctx *middleware.Context, params martini.Params, form auth.CreateIssueForm) { @@ -794,14 +804,14 @@ func Milestones(ctx *middleware.Context) { } else { ctx.Data["State"] = "open" } - ctx.HTML(200, "issue/milestone") + ctx.HTML(200, MILESTONE) } func NewMilestone(ctx *middleware.Context) { ctx.Data["Title"] = "New Milestone" ctx.Data["IsRepoToolbarIssues"] = true ctx.Data["IsRepoToolbarIssuesList"] = true - ctx.HTML(200, "issue/milestone_new") + ctx.HTML(200, MILESTONE_NEW) } func NewMilestonePost(ctx *middleware.Context, form auth.CreateMilestoneForm) { @@ -809,6 +819,11 @@ func NewMilestonePost(ctx *middleware.Context, form auth.CreateMilestoneForm) { ctx.Data["IsRepoToolbarIssues"] = true ctx.Data["IsRepoToolbarIssuesList"] = true + if ctx.HasError() { + ctx.HTML(200, MILESTONE_NEW) + return + } + var deadline time.Time var err error if len(form.Deadline) == 0 { @@ -890,7 +905,7 @@ func UpdateMilestone(ctx *middleware.Context, params martini.Params) { } ctx.Data["Milestone"] = mile - ctx.HTML(200, "issue/milestone_edit") + ctx.HTML(200, MILESTONE_EDIT) } func UpdateMilestonePost(ctx *middleware.Context, params martini.Params, form auth.CreateMilestoneForm) { @@ -914,6 +929,11 @@ func UpdateMilestonePost(ctx *middleware.Context, params martini.Params, form au return } + if ctx.HasError() { + ctx.HTML(200, MILESTONE_EDIT) + return + } + var deadline time.Time if len(form.Deadline) == 0 { form.Deadline = "12/31/9999" diff --git a/routers/repo/pull.go b/routers/repo/pull.go index 430c6a815..db208f9fb 100644 --- a/routers/repo/pull.go +++ b/routers/repo/pull.go @@ -7,10 +7,15 @@ package repo import ( "github.com/go-martini/martini" + "github.com/gogits/gogs/modules/base" "github.com/gogits/gogs/modules/middleware" ) +const ( + PULLS base.TplName = "repo/pulls" +) + func Pulls(ctx *middleware.Context, params martini.Params) { ctx.Data["IsRepoToolbarPulls"] = true - ctx.HTML(200, "repo/pulls") + ctx.HTML(200, PULLS) } diff --git a/routers/repo/release.go b/routers/repo/release.go index b6149b63a..a901436fc 100644 --- a/routers/repo/release.go +++ b/routers/repo/release.go @@ -14,6 +14,12 @@ import ( "github.com/gogits/gogs/modules/middleware" ) +const ( + RELEASES base.TplName = "repo/release/list" + RELEASE_NEW base.TplName = "repo/release/new" + RELEASE_EDIT base.TplName = "repo/release/edit" +) + func Releases(ctx *middleware.Context) { ctx.Data["Title"] = "Releases" ctx.Data["IsRepoToolbarReleases"] = true @@ -100,7 +106,7 @@ func Releases(ctx *middleware.Context) { } models.SortReleases(tags) ctx.Data["Releases"] = tags - ctx.HTML(200, "release/list") + ctx.HTML(200, RELEASES) } func NewRelease(ctx *middleware.Context) { @@ -112,7 +118,7 @@ func NewRelease(ctx *middleware.Context) { ctx.Data["Title"] = "New Release" ctx.Data["IsRepoToolbarReleases"] = true ctx.Data["IsRepoReleaseNew"] = true - ctx.HTML(200, "release/new") + ctx.HTML(200, RELEASE_NEW) } func NewReleasePost(ctx *middleware.Context, form auth.NewReleaseForm) { @@ -126,7 +132,7 @@ func NewReleasePost(ctx *middleware.Context, form auth.NewReleaseForm) { ctx.Data["IsRepoReleaseNew"] = true if ctx.HasError() { - ctx.HTML(200, "release/new") + ctx.HTML(200, RELEASE_NEW) return } @@ -187,7 +193,7 @@ func EditRelease(ctx *middleware.Context, params martini.Params) { ctx.Data["Title"] = "Edit Release" ctx.Data["IsRepoToolbarReleases"] = true - ctx.HTML(200, "release/edit") + ctx.HTML(200, RELEASE_EDIT) } func EditReleasePost(ctx *middleware.Context, params martini.Params, form auth.EditReleaseForm) { @@ -208,6 +214,11 @@ func EditReleasePost(ctx *middleware.Context, params martini.Params, form auth.E } ctx.Data["Release"] = rel + if ctx.HasError() { + ctx.HTML(200, RELEASE_EDIT) + return + } + ctx.Data["Title"] = "Edit Release" ctx.Data["IsRepoToolbarReleases"] = true diff --git a/routers/repo/repo.go b/routers/repo/repo.go index 6154eede3..2ead24df3 100644 --- a/routers/repo/repo.go +++ b/routers/repo/repo.go @@ -25,12 +25,18 @@ import ( "github.com/gogits/gogs/modules/middleware" ) +const ( + CREATE base.TplName = "repo/create" + MIGRATE base.TplName = "repo/migrate" + SINGLE base.TplName = "repo/single" +) + func Create(ctx *middleware.Context) { ctx.Data["Title"] = "Create repository" ctx.Data["PageIsNewRepo"] = true ctx.Data["LanguageIgns"] = models.LanguageIgns ctx.Data["Licenses"] = models.Licenses - ctx.HTML(200, "repo/create") + ctx.HTML(200, CREATE) } func CreatePost(ctx *middleware.Context, form auth.CreateRepoForm) { @@ -40,7 +46,7 @@ func CreatePost(ctx *middleware.Context, form auth.CreateRepoForm) { ctx.Data["Licenses"] = models.Licenses if ctx.HasError() { - ctx.HTML(200, "repo/create") + ctx.HTML(200, CREATE) return } @@ -51,25 +57,25 @@ func CreatePost(ctx *middleware.Context, form auth.CreateRepoForm) { ctx.Redirect("/" + ctx.User.Name + "/" + form.RepoName) return } else if err == models.ErrRepoAlreadyExist { - ctx.RenderWithErr("Repository name has already been used", "repo/create", &form) + ctx.RenderWithErr("Repository name has already been used", CREATE, &form) return } else if err == models.ErrRepoNameIllegal { - ctx.RenderWithErr(models.ErrRepoNameIllegal.Error(), "repo/create", &form) + ctx.RenderWithErr(models.ErrRepoNameIllegal.Error(), CREATE, &form) return } if repo != nil { if errDelete := models.DeleteRepository(ctx.User.Id, repo.Id, ctx.User.Name); errDelete != nil { - log.Error("repo.MigratePost(CreatePost): %v", errDelete) + log.Error("repo.CreatePost(DeleteRepository): %v", errDelete) } } - ctx.Handle(500, "repo.Create", err) + ctx.Handle(500, "repo.CreatePost", err) } func Migrate(ctx *middleware.Context) { ctx.Data["Title"] = "Migrate repository" ctx.Data["PageIsNewRepo"] = true - ctx.HTML(200, "repo/migrate") + ctx.HTML(200, MIGRATE) } func MigratePost(ctx *middleware.Context, form auth.MigrateRepoForm) { @@ -77,7 +83,7 @@ func MigratePost(ctx *middleware.Context, form auth.MigrateRepoForm) { ctx.Data["PageIsNewRepo"] = true if ctx.HasError() { - ctx.HTML(200, "repo/migrate") + ctx.HTML(200, MIGRATE) return } @@ -91,10 +97,10 @@ func MigratePost(ctx *middleware.Context, form auth.MigrateRepoForm) { ctx.Redirect("/" + ctx.User.Name + "/" + form.RepoName) return } else if err == models.ErrRepoAlreadyExist { - ctx.RenderWithErr("Repository name has already been used", "repo/migrate", &form) + ctx.RenderWithErr("Repository name has already been used", MIGRATE, &form) return } else if err == models.ErrRepoNameIllegal { - ctx.RenderWithErr(models.ErrRepoNameIllegal.Error(), "repo/migrate", &form) + ctx.RenderWithErr(models.ErrRepoNameIllegal.Error(), MIGRATE, &form) return } @@ -105,7 +111,7 @@ func MigratePost(ctx *middleware.Context, form auth.MigrateRepoForm) { } if strings.Contains(err.Error(), "Authentication failed") { - ctx.RenderWithErr(err.Error(), "repo/migrate", &form) + ctx.RenderWithErr(err.Error(), MIGRATE, &form) return } ctx.Handle(500, "repo.Migrate", err) @@ -291,7 +297,7 @@ func Single(ctx *middleware.Context, params martini.Params) { ctx.Data["Treenames"] = treenames ctx.Data["TreePath"] = treePath ctx.Data["BranchLink"] = branchLink - ctx.HTML(200, "repo/single") + ctx.HTML(200, SINGLE) } func basicEncode(username, password string) string { diff --git a/routers/repo/setting.go b/routers/repo/setting.go index 6313971c2..6479cb304 100644 --- a/routers/repo/setting.go +++ b/routers/repo/setting.go @@ -20,10 +20,19 @@ import ( "github.com/gogits/gogs/modules/setting" ) +const ( + SETTING base.TplName = "repo/setting" + COLLABORATION base.TplName = "repo/collaboration" + + HOOKS base.TplName = "repo/hooks" + HOOK_ADD base.TplName = "repo/hook_add" + HOOK_EDIT base.TplName = "repo/hook_edit" +) + func Setting(ctx *middleware.Context) { ctx.Data["IsRepoToolbarSetting"] = true ctx.Data["Title"] = strings.TrimPrefix(ctx.Repo.RepoLink, "/") + " - settings" - ctx.HTML(200, "repo/setting") + ctx.HTML(200, SETTING) } func SettingPost(ctx *middleware.Context, form auth.RepoSettingForm) { @@ -32,7 +41,7 @@ func SettingPost(ctx *middleware.Context, form auth.RepoSettingForm) { switch ctx.Query("action") { case "update": if ctx.HasError() { - ctx.HTML(200, "repo/setting") + ctx.HTML(200, SETTING) return } @@ -44,7 +53,7 @@ func SettingPost(ctx *middleware.Context, form auth.RepoSettingForm) { ctx.Handle(500, "setting.SettingPost(update: check existence)", err) return } else if isExist { - ctx.RenderWithErr("Repository name has been taken in your repositories.", "repo/setting", nil) + ctx.RenderWithErr("Repository name has been taken in your repositories.", SETTING, nil) return } else if err = models.ChangeRepositoryName(ctx.Repo.Owner.Name, ctx.Repo.Repository.Name, newRepoName); err != nil { ctx.Handle(500, "setting.SettingPost(change repository name)", err) @@ -84,7 +93,7 @@ func SettingPost(ctx *middleware.Context, form auth.RepoSettingForm) { ctx.Redirect(fmt.Sprintf("/%s/%s/settings", ctx.Repo.Owner.Name, ctx.Repo.Repository.Name)) case "transfer": if len(ctx.Repo.Repository.Name) == 0 || ctx.Repo.Repository.Name != ctx.Query("repository") { - ctx.RenderWithErr("Please make sure you entered repository name is correct.", "repo/setting", nil) + ctx.RenderWithErr("Please make sure you entered repository name is correct.", SETTING, nil) return } else if ctx.Repo.Repository.IsMirror { ctx.Error(404) @@ -98,7 +107,7 @@ func SettingPost(ctx *middleware.Context, form auth.RepoSettingForm) { ctx.Handle(500, "setting.SettingPost(transfer: check existence)", err) return } else if !isExist { - ctx.RenderWithErr("Please make sure you entered owner name is correct.", "repo/setting", nil) + ctx.RenderWithErr("Please make sure you entered owner name is correct.", SETTING, nil) return } else if err = models.TransferOwnership(ctx.User, newOwner, ctx.Repo.Repository); err != nil { ctx.Handle(500, "setting.SettingPost(transfer repository)", err) @@ -109,7 +118,7 @@ func SettingPost(ctx *middleware.Context, form auth.RepoSettingForm) { ctx.Redirect("/") case "delete": if len(ctx.Repo.Repository.Name) == 0 || ctx.Repo.Repository.Name != ctx.Query("repository") { - ctx.RenderWithErr("Please make sure you entered repository name is correct.", "repo/setting", nil) + ctx.RenderWithErr("Please make sure you entered repository name is correct.", SETTING, nil) return } @@ -156,7 +165,7 @@ func Collaboration(ctx *middleware.Context) { } ctx.Data["Collaborators"] = us - ctx.HTML(200, "repo/collaboration") + ctx.HTML(200, COLLABORATION) } func CollaborationPost(ctx *middleware.Context) { @@ -226,13 +235,13 @@ func WebHooks(ctx *middleware.Context) { } ctx.Data["Webhooks"] = ws - ctx.HTML(200, "repo/hooks") + ctx.HTML(200, HOOKS) } func WebHooksAdd(ctx *middleware.Context) { ctx.Data["IsRepoToolbarWebHooks"] = true ctx.Data["Title"] = strings.TrimPrefix(ctx.Repo.RepoLink, "/") + " - Add Webhook" - ctx.HTML(200, "repo/hooks_add") + ctx.HTML(200, HOOK_ADD) } func WebHooksAddPost(ctx *middleware.Context, form auth.NewWebhookForm) { @@ -240,7 +249,7 @@ func WebHooksAddPost(ctx *middleware.Context, form auth.NewWebhookForm) { ctx.Data["Title"] = strings.TrimPrefix(ctx.Repo.RepoLink, "/") + " - Add Webhook" if ctx.HasError() { - ctx.HTML(200, "repo/hooks_add") + ctx.HTML(200, HOOK_ADD) return } @@ -293,40 +302,46 @@ func WebHooksEdit(ctx *middleware.Context, params martini.Params) { w.GetEvent() ctx.Data["Webhook"] = w - ctx.HTML(200, "repo/hooks_edit") + ctx.HTML(200, HOOK_EDIT) } func WebHooksEditPost(ctx *middleware.Context, params martini.Params, form auth.NewWebhookForm) { ctx.Data["IsRepoToolbarWebHooks"] = true ctx.Data["Title"] = strings.TrimPrefix(ctx.Repo.RepoLink, "/") + " - Webhook" - if ctx.HasError() { - ctx.HTML(200, "repo/hooks_add") - return - } - hookId, _ := base.StrTo(params["id"]).Int64() if hookId == 0 { ctx.Handle(404, "setting.WebHooksEditPost", nil) return } + w, err := models.GetWebhookById(hookId) + if err != nil { + if err == models.ErrWebhookNotExist { + ctx.Handle(404, "setting.WebHooksEditPost(GetWebhookById)", nil) + } else { + ctx.Handle(500, "setting.WebHooksEditPost(GetWebhookById)", err) + } + return + } + + if ctx.HasError() { + ctx.HTML(200, HOOK_EDIT) + return + } + ct := models.JSON if form.ContentType == "2" { ct = models.FORM } - w := &models.Webhook{ - Id: hookId, - RepoId: ctx.Repo.Repository.Id, - Url: form.Url, - ContentType: ct, - Secret: form.Secret, - HookEvent: &models.HookEvent{ - PushOnly: form.PushOnly, - }, - IsActive: form.Active, + w.Url = form.Url + w.ContentType = ct + w.Secret = form.Secret + w.HookEvent = &models.HookEvent{ + PushOnly: form.PushOnly, } + w.IsActive = form.Active if err := w.UpdateEvent(); err != nil { ctx.Handle(500, "setting.WebHooksEditPost(UpdateEvent)", err) return diff --git a/routers/user/home.go b/routers/user/home.go index a9674ac24..7d0333cb4 100644 --- a/routers/user/home.go +++ b/routers/user/home.go @@ -17,6 +17,14 @@ import ( "github.com/gogits/gogs/modules/middleware" ) +const ( + DASHBOARD base.TplName = "user/dashboard" + PROFILE base.TplName = "user/profile" + ISSUES base.TplName = "user/issue" + PULLS base.TplName = "user/pulls" + STARS base.TplName = "user/stars" +) + func Dashboard(ctx *middleware.Context) { ctx.Data["Title"] = "Dashboard" ctx.Data["PageIsUserDashboard"] = true @@ -52,7 +60,7 @@ func Dashboard(ctx *middleware.Context) { feeds = append(feeds, act) } ctx.Data["Feeds"] = feeds - ctx.HTML(200, "user/dashboard") + ctx.HTML(200, DASHBOARD) } func Profile(ctx *middleware.Context, params martini.Params) { @@ -87,7 +95,7 @@ func Profile(ctx *middleware.Context, params martini.Params) { } } - ctx.HTML(200, "user/profile") + ctx.HTML(200, PROFILE) } func Email2User(ctx *middleware.Context) { @@ -254,13 +262,13 @@ func Issues(ctx *middleware.Context) { } else { ctx.Data["ShowCount"] = issueStats.OpenCount } - ctx.HTML(200, "user/issue") + ctx.HTML(200, ISSUES) } func Pulls(ctx *middleware.Context) { - ctx.HTML(200, "user/pulls") + ctx.HTML(200, PULLS) } func Stars(ctx *middleware.Context) { - ctx.HTML(200, "user/stars") + ctx.HTML(200, STARS) } diff --git a/routers/user/setting.go b/routers/user/setting.go index 1fae516a4..9075ee0b4 100644 --- a/routers/user/setting.go +++ b/routers/user/setting.go @@ -14,12 +14,21 @@ import ( "github.com/gogits/gogs/modules/middleware" ) +const ( + SETTING base.TplName = "user/setting" + SOCIAL base.TplName = "user/social" + PASSWORD base.TplName = "user/password" + PUBLICKEY base.TplName = "user/publickey" + NOTIFICATION base.TplName = "user/notification" + SECURITY base.TplName = "user/security" +) + func Setting(ctx *middleware.Context) { ctx.Data["Title"] = "Setting" ctx.Data["PageIsUserSetting"] = true ctx.Data["IsUserPageSetting"] = true ctx.Data["Owner"] = ctx.User - ctx.HTML(200, "user/setting") + ctx.HTML(200, SETTING) } func SettingPost(ctx *middleware.Context, form auth.UpdateProfileForm) { @@ -28,7 +37,7 @@ func SettingPost(ctx *middleware.Context, form auth.UpdateProfileForm) { ctx.Data["IsUserPageSetting"] = true if ctx.HasError() { - ctx.HTML(200, "user/setting") + ctx.HTML(200, SETTING) return } @@ -90,14 +99,14 @@ func SettingSocial(ctx *middleware.Context) { ctx.Handle(500, "user.SettingSocial(GetOauthByUserId)", err) return } - ctx.HTML(200, "user/social") + ctx.HTML(200, SOCIAL) } func SettingPassword(ctx *middleware.Context) { ctx.Data["Title"] = "Password" ctx.Data["PageIsUserSetting"] = true ctx.Data["IsUserPageSettingPasswd"] = true - ctx.HTML(200, "user/password") + ctx.HTML(200, PASSWORD) } func SettingPasswordPost(ctx *middleware.Context, form auth.UpdatePasswdForm) { @@ -106,7 +115,7 @@ func SettingPasswordPost(ctx *middleware.Context, form auth.UpdatePasswdForm) { ctx.Data["IsUserPageSettingPasswd"] = true if ctx.HasError() { - ctx.HTML(200, "user/password") + ctx.HTML(200, PASSWORD) return } @@ -207,7 +216,7 @@ func SettingSSHKeys(ctx *middleware.Context, form auth.AddSSHKeyForm) { } } - ctx.HTML(200, "user/publickey") + ctx.HTML(200, PUBLICKEY) } func SettingNotification(ctx *middleware.Context) { @@ -215,7 +224,7 @@ func SettingNotification(ctx *middleware.Context) { ctx.Data["Title"] = "Notification" ctx.Data["PageIsUserSetting"] = true ctx.Data["IsUserPageSettingNotify"] = true - ctx.HTML(200, "user/notification") + ctx.HTML(200, NOTIFICATION) } func SettingSecurity(ctx *middleware.Context) { @@ -223,5 +232,5 @@ func SettingSecurity(ctx *middleware.Context) { ctx.Data["Title"] = "Security" ctx.Data["PageIsUserSetting"] = true ctx.Data["IsUserPageSettingSecurity"] = true - ctx.HTML(200, "user/security") + ctx.HTML(200, SECURITY) } diff --git a/routers/user/user.go b/routers/user/user.go index 8fcbeb6a4..8144730e0 100644 --- a/routers/user/user.go +++ b/routers/user/user.go @@ -17,12 +17,21 @@ import ( "github.com/gogits/gogs/modules/setting" ) +const ( + SIGNIN base.TplName = "user/signin" + SIGNUP base.TplName = "user/signup" + DELETE base.TplName = "user/delete" + ACTIVATE base.TplName = "user/activate" + FORGOT_PASSWORD base.TplName = "user/forgot_passwd" + RESET_PASSWORD base.TplName = "user/reset_passwd" +) + func SignIn(ctx *middleware.Context) { ctx.Data["Title"] = "Log In" if _, ok := ctx.Session.Get("socialId").(int64); ok { ctx.Data["IsSocialLogin"] = true - ctx.HTML(200, "user/signin") + ctx.HTML(200, SIGNIN) return } @@ -34,7 +43,7 @@ func SignIn(ctx *middleware.Context) { // Check auto-login. uname := ctx.GetCookie(setting.CookieUserName) if len(uname) == 0 { - ctx.HTML(200, "user/signin") + ctx.HTML(200, SIGNIN) return } @@ -57,7 +66,7 @@ func SignIn(ctx *middleware.Context) { secret := base.EncodeMd5(user.Rands + user.Passwd) value, _ := ctx.GetSecureCookie(secret, setting.CookieRememberName) if value != user.Name { - ctx.HTML(200, "user/signin") + ctx.HTML(200, SIGNIN) return } @@ -86,7 +95,7 @@ func SignInPost(ctx *middleware.Context, form auth.LogInForm) { } if ctx.HasError() { - ctx.HTML(200, "user/signin") + ctx.HTML(200, SIGNIN) return } @@ -94,7 +103,7 @@ func SignInPost(ctx *middleware.Context, form auth.LogInForm) { if err != nil { if err == models.ErrUserNotExist { log.Trace("%s Log in failed: %s", ctx.Req.RequestURI, form.UserName) - ctx.RenderWithErr("Username or password is not correct", "user/signin", &form) + ctx.RenderWithErr("Username or password is not correct", SIGNIN, &form) return } @@ -151,7 +160,7 @@ func SignUp(ctx *middleware.Context) { if setting.Service.DisableRegistration { ctx.Data["DisableRegistration"] = true - ctx.HTML(200, "user/signup") + ctx.HTML(200, SIGNUP) return } @@ -160,7 +169,7 @@ func SignUp(ctx *middleware.Context) { return } - ctx.HTML(200, "user/signup") + ctx.HTML(200, SIGNUP) } func oauthSignUp(ctx *middleware.Context, sid int64) { @@ -180,7 +189,7 @@ func oauthSignUp(ctx *middleware.Context, sid int64) { ctx.Data["username"] = strings.Replace(ctx.Session.Get("socialName").(string), " ", "", -1) ctx.Data["email"] = ctx.Session.Get("socialEmail") log.Trace("user.oauthSignUp(social ID): %v", ctx.Session.Get("socialId")) - ctx.HTML(200, "user/signup") + ctx.HTML(200, SIGNUP) } func SignUpPost(ctx *middleware.Context, form auth.RegisterForm) { @@ -198,14 +207,14 @@ func SignUpPost(ctx *middleware.Context, form auth.RegisterForm) { } if ctx.HasError() { - ctx.HTML(200, "user/signup") + ctx.HTML(200, SIGNUP) return } if form.Password != form.RetypePasswd { ctx.Data["Err_Password"] = true ctx.Data["Err_RetypePasswd"] = true - ctx.RenderWithErr("Password and re-type password are not same.", "user/signup", &form) + ctx.RenderWithErr("Password and re-type password are not same.", SIGNUP, &form) return } @@ -221,12 +230,12 @@ func SignUpPost(ctx *middleware.Context, form auth.RegisterForm) { switch err { case models.ErrUserAlreadyExist: ctx.Data["Err_UserName"] = true - ctx.RenderWithErr("Username has been already taken", "user/signup", &form) + ctx.RenderWithErr("Username has been already taken", SIGNUP, &form) case models.ErrEmailAlreadyUsed: ctx.Data["Err_Email"] = true - ctx.RenderWithErr("E-mail address has been already used", "user/signup", &form) + ctx.RenderWithErr("E-mail address has been already used", SIGNUP, &form) case models.ErrUserNameIllegal: - ctx.RenderWithErr(models.ErrRepoNameIllegal.Error(), "user/signup", &form) + ctx.RenderWithErr(models.ErrRepoNameIllegal.Error(), SIGNUP, &form) default: ctx.Handle(500, "user.SignUpPost(RegisterUser)", err) } @@ -265,7 +274,7 @@ func Delete(ctx *middleware.Context) { ctx.Data["Title"] = "Delete Account" ctx.Data["PageIsUserSetting"] = true ctx.Data["IsUserPageSettingDelete"] = true - ctx.HTML(200, "user/delete") + ctx.HTML(200, DELETE) } func DeletePost(ctx *middleware.Context) { @@ -321,7 +330,7 @@ func Activate(ctx *middleware.Context) { } else { ctx.Data["ServiceNotEnabled"] = true } - ctx.HTML(200, "user/activate") + ctx.HTML(200, ACTIVATE) return } @@ -343,7 +352,7 @@ func Activate(ctx *middleware.Context) { } ctx.Data["IsActivateFailed"] = true - ctx.HTML(200, "user/activate") + ctx.HTML(200, ACTIVATE) } func ForgotPasswd(ctx *middleware.Context) { @@ -351,12 +360,12 @@ func ForgotPasswd(ctx *middleware.Context) { if setting.MailService == nil { ctx.Data["IsResetDisable"] = true - ctx.HTML(200, "user/forgot_passwd") + ctx.HTML(200, FORGOT_PASSWORD) return } ctx.Data["IsResetRequest"] = true - ctx.HTML(200, "user/forgot_passwd") + ctx.HTML(200, FORGOT_PASSWORD) } func ForgotPasswdPost(ctx *middleware.Context) { @@ -381,7 +390,7 @@ func ForgotPasswdPost(ctx *middleware.Context) { if ctx.Cache.IsExist("MailResendLimit_" + u.LowerName) { ctx.Data["ResendLimited"] = true - ctx.HTML(200, "user/forgot_passwd") + ctx.HTML(200, FORGOT_PASSWORD) return } @@ -393,7 +402,7 @@ func ForgotPasswdPost(ctx *middleware.Context) { ctx.Data["Email"] = email ctx.Data["Hours"] = setting.Service.ActiveCodeLives / 60 ctx.Data["IsResetSent"] = true - ctx.HTML(200, "user/forgot_passwd") + ctx.HTML(200, FORGOT_PASSWORD) } func ResetPasswd(ctx *middleware.Context) { @@ -406,7 +415,7 @@ func ResetPasswd(ctx *middleware.Context) { } ctx.Data["Code"] = code ctx.Data["IsResetForm"] = true - ctx.HTML(200, "user/reset_passwd") + ctx.HTML(200, RESET_PASSWORD) } func ResetPasswdPost(ctx *middleware.Context) { @@ -443,5 +452,5 @@ func ResetPasswdPost(ctx *middleware.Context) { } ctx.Data["IsResetFailed"] = true - ctx.HTML(200, "user/reset_passwd") + ctx.HTML(200, RESET_PASSWORD) } diff --git a/templates/VERSION b/templates/VERSION index 7d143dcc1..414dc2efe 100644 --- a/templates/VERSION +++ b/templates/VERSION @@ -1 +1 @@ -0.4.5.0621 Alpha \ No newline at end of file +0.4.5.0622 Alpha \ No newline at end of file diff --git a/templates/repo/branches.tmpl b/templates/repo/branch.tmpl similarity index 100% rename from templates/repo/branches.tmpl rename to templates/repo/branch.tmpl diff --git a/templates/repo/hooks_add.tmpl b/templates/repo/hook_add.tmpl similarity index 100% rename from templates/repo/hooks_add.tmpl rename to templates/repo/hook_add.tmpl diff --git a/templates/repo/hooks_edit.tmpl b/templates/repo/hook_edit.tmpl similarity index 100% rename from templates/repo/hooks_edit.tmpl rename to templates/repo/hook_edit.tmpl diff --git a/templates/user/issue.tmpl b/templates/user/issues.tmpl similarity index 100% rename from templates/user/issue.tmpl rename to templates/user/issues.tmpl From ea507e20d45ef90b1552d72341038354f8801cf4 Mon Sep 17 00:00:00 2001 From: fuxiaohei Date: Mon, 23 Jun 2014 11:40:49 +0800 Subject: [PATCH 05/23] add organization create page --- cmd/web.go | 1 + public/css/gogs.css | 2 +- routers/org/org.go | 18 ++++++++++------ templates/org/new.tmpl | 48 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 61 insertions(+), 8 deletions(-) create mode 100644 templates/org/new.tmpl diff --git a/cmd/web.go b/cmd/web.go index b2521de96..9786576d7 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -189,6 +189,7 @@ func runWeb(*cli.Context) { reqOwner := middleware.RequireOwner() m.Group("/o", func(r martini.Router) { + r.Get("/create",org.New) r.Get("/:org", org.Organization) r.Get("/:org/members", org.Members) r.Get("/:org/teams", org.Teams) diff --git a/public/css/gogs.css b/public/css/gogs.css index 7fdde19cc..bb341a8a3 100755 --- a/public/css/gogs.css +++ b/public/css/gogs.css @@ -372,7 +372,7 @@ html, body { /* gogits repo create */ -#repo-create { +#repo-create, #org-create { width: 800px; } diff --git a/routers/org/org.go b/routers/org/org.go index 21f2a189c..4d9b831de 100644 --- a/routers/org/org.go +++ b/routers/org/org.go @@ -6,17 +6,21 @@ import ( ) func Organization(ctx *middleware.Context, params martini.Params) { - ctx.Data["Title"] = "Organization " + params["org"] + ctx.Data["Title"] = "Organization "+params["org"] ctx.HTML(200, "org/org") } -func Members(ctx *middleware.Context,params martini.Params){ - ctx.Data["Title"] = "Organization " + params["org"]+" Members" - ctx.HTML(200,"org/members") +func Members(ctx *middleware.Context, params martini.Params) { + ctx.Data["Title"] = "Organization "+params["org"]+" Members" + ctx.HTML(200, "org/members") } -func Teams(ctx *middleware.Context,params martini.Params){ - ctx.Data["Title"] = "Organization " + params["org"]+" Teams" - ctx.HTML(200,"org/teams") +func Teams(ctx *middleware.Context, params martini.Params) { + ctx.Data["Title"] = "Organization "+params["org"]+" Teams" + ctx.HTML(200, "org/teams") } +func New(ctx *middleware.Context) { + ctx.Data["Title"] = "Create an Organization" + ctx.HTML(200, "org/new") +} diff --git a/templates/org/new.tmpl b/templates/org/new.tmpl new file mode 100644 index 000000000..baa9c9dfa --- /dev/null +++ b/templates/org/new.tmpl @@ -0,0 +1,48 @@ +{{template "base/head" .}} +{{template "base/navbar" .}} +
+
+ {{.CsrfTokenHtml}} +

Create New Organization

+ {{template "base/alert" .}} +
+ +
+

{{.SignedUserName}}

+ +
+
+ +
+ +
+ + Great organization names are short and memorable. +
+
+ +
+ +
+ + Organization's Email receives all notifications and confirmations. +
+
+ + + +
+
+ + Cancel +
+
+
+
+{{template "base/footer" .}} \ No newline at end of file From f393dc652007238c27bd5d1954a03ba97412eee5 Mon Sep 17 00:00:00 2001 From: fuxiaohei Date: Mon, 23 Jun 2014 12:08:53 +0800 Subject: [PATCH 06/23] add organization dashboard page --- cmd/web.go | 3 +- public/css/gogs.css | 8 ++++ routers/org/org.go | 5 +++ templates/org/dashboard.tmpl | 73 +++++++++++++++++++++++++++++++++++ templates/user/dashboard.tmpl | 4 +- 5 files changed, 91 insertions(+), 2 deletions(-) create mode 100644 templates/org/dashboard.tmpl diff --git a/cmd/web.go b/cmd/web.go index 9786576d7..65ea60643 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -189,8 +189,9 @@ func runWeb(*cli.Context) { reqOwner := middleware.RequireOwner() m.Group("/o", func(r martini.Router) { - r.Get("/create",org.New) + r.Get("/create", org.New) r.Get("/:org", org.Organization) + r.Get("/:org/dashboard", org.Dashboard) r.Get("/:org/members", org.Members) r.Get("/:org/teams", org.Teams) }) diff --git a/public/css/gogs.css b/public/css/gogs.css index bb341a8a3..1f465d845 100755 --- a/public/css/gogs.css +++ b/public/css/gogs.css @@ -662,6 +662,14 @@ html, body { padding: .8em 1.2em; } +#dashboard-switch-menu > li > a:hover { + text-decoration: none; +} + +#dashboard-switch-menu > li > a img, #dashboard-switch button img { + margin-right: 6px; +} + #dashboard-switch-menu > li { border-bottom: 1px solid #eaeaea; } diff --git a/routers/org/org.go b/routers/org/org.go index 4d9b831de..8073d10b8 100644 --- a/routers/org/org.go +++ b/routers/org/org.go @@ -24,3 +24,8 @@ func New(ctx *middleware.Context) { ctx.Data["Title"] = "Create an Organization" ctx.HTML(200, "org/new") } + +func Dashboard(ctx *middleware.Context, params martini.Params) { + ctx.Data["Title"] = "Dashboard" + ctx.HTML(200, "org/dashboard") +} diff --git a/templates/org/dashboard.tmpl b/templates/org/dashboard.tmpl new file mode 100644 index 000000000..f86de1f42 --- /dev/null +++ b/templates/org/dashboard.tmpl @@ -0,0 +1,73 @@ +{{template "base/head" .}} +{{template "base/navbar" .}} +
+
+
+ + + +
+ +

News Feed

+
+
+
+ {{if .HasInfo}}
{{.InfoMsg}}
{{end}} +
+
    + {{range .Feeds}} +
  • + +
    {{TimeSince .Created}}
    {{ActionDesc . | str2html}}
    + +
  • + {{else}} +
  • Oh. Looks like there isn't any activity here yet. Get Busy!
  • + {{end}} +
+
+
+
+
Repositories +
+ + +
+
+ +
+ +
+
+
+
+{{template "base/footer" .}} diff --git a/templates/user/dashboard.tmpl b/templates/user/dashboard.tmpl index c44ba3627..12018ad89 100644 --- a/templates/user/dashboard.tmpl +++ b/templates/user/dashboard.tmpl @@ -12,7 +12,9 @@ From fb53cc4fa82bbbbba4b8b0281d5f5657b1a6fafc Mon Sep 17 00:00:00 2001 From: fuxiaohei Date: Mon, 23 Jun 2014 19:11:20 +0800 Subject: [PATCH 07/23] add organization setting page --- cmd/web.go | 1 + routers/org/org.go | 5 ++ templates/org/setting.tmpl | 151 +++++++++++++++++++++++++++++++++++++ 3 files changed, 157 insertions(+) create mode 100644 templates/org/setting.tmpl diff --git a/cmd/web.go b/cmd/web.go index 65ea60643..d29183a9d 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -194,6 +194,7 @@ func runWeb(*cli.Context) { r.Get("/:org/dashboard", org.Dashboard) r.Get("/:org/members", org.Members) r.Get("/:org/teams", org.Teams) + r.Get("/:org/setting", org.Setting) }) m.Group("/:username/:reponame", func(r martini.Router) { diff --git a/routers/org/org.go b/routers/org/org.go index 8073d10b8..ff97402eb 100644 --- a/routers/org/org.go +++ b/routers/org/org.go @@ -29,3 +29,8 @@ func Dashboard(ctx *middleware.Context, params martini.Params) { ctx.Data["Title"] = "Dashboard" ctx.HTML(200, "org/dashboard") } + +func Setting(ctx *middleware.Context, param martini.Params) { + ctx.Data["Title"] = "Setting" + ctx.HTML(200, "org/setting") +} diff --git a/templates/org/setting.tmpl b/templates/org/setting.tmpl new file mode 100644 index 000000000..1be9707a1 --- /dev/null +++ b/templates/org/setting.tmpl @@ -0,0 +1,151 @@ +{{template "base/head" .}} +{{template "base/navbar" .}} +
+
+
+ + +
+ +
+
+
+
+ +
+
+ {{template "base/alert" .}} +
+
+ Repository Options +
+ +
+
+ {{.CsrfTokenHtml}} + + +
+ + +
+ +
+
+ +
+ + +
+ +
+
+ +
+ + +
+ +
+
+ +
+ + +
+ +
+
+ +
+ + +
+ +
+
+ +
+
+ +
+
+
+
+
+ +
+
+ Danger Zone +
+
+ +
+
Delete this organization
+
Once you delete this organization and all repositories in, there is no going back. Please be + certain. +
+ + + +
+
+
+
+{{template "base/footer" .}} From 47d29a1ee027734dcbbd1a6ed4d8ff3dde1a789b Mon Sep 17 00:00:00 2001 From: Unknown Date: Mon, 23 Jun 2014 16:22:34 -0400 Subject: [PATCH 08/23] Mirror fix on #248 --- cmd/update.go | 4 +++- gogs.go | 2 +- models/update.go | 26 +++++++++++++------------- routers/repo/http.go | 5 ++++- templates/VERSION | 2 +- 5 files changed, 22 insertions(+), 17 deletions(-) diff --git a/cmd/update.go b/cmd/update.go index d0e0acded..c030b6cfb 100644 --- a/cmd/update.go +++ b/cmd/update.go @@ -42,5 +42,7 @@ func runUpdate(c *cli.Context) { repoUserName := os.Getenv("repoUserName") repoName := os.Getenv("repoName") - models.Update(args[0], args[1], args[2], userName, repoUserName, repoName, userId) + if err := models.Update(args[0], args[1], args[2], userName, repoUserName, repoName, userId); err != nil { + log.GitLogger.Fatal(err.Error()) + } } diff --git a/gogs.go b/gogs.go index 03c286016..a39d2d433 100644 --- a/gogs.go +++ b/gogs.go @@ -17,7 +17,7 @@ import ( "github.com/gogits/gogs/modules/setting" ) -const APP_VER = "0.4.5.0622 Alpha" +const APP_VER = "0.4.5.0623 Alpha" func init() { runtime.GOMAXPROCS(runtime.NumCPU()) diff --git a/models/update.go b/models/update.go index 5675a94cf..3328f2213 100644 --- a/models/update.go +++ b/models/update.go @@ -6,6 +6,7 @@ package models import ( "container/list" + "fmt" "os/exec" "strings" @@ -15,11 +16,11 @@ import ( "github.com/gogits/gogs/modules/log" ) -func Update(refName, oldCommitId, newCommitId, userName, repoUserName, repoName string, userId int64) { +func Update(refName, oldCommitId, newCommitId, userName, repoUserName, repoName string, userId int64) error { isNew := strings.HasPrefix(oldCommitId, "0000000") if isNew && strings.HasPrefix(newCommitId, "0000000") { - log.GitLogger.Fatal("old rev and new rev both 000000") + return fmt.Errorf("old rev and new rev both 000000") } f := RepoPath(repoUserName, repoName) @@ -31,18 +32,17 @@ func Update(refName, oldCommitId, newCommitId, userName, repoUserName, repoName isDel := strings.HasPrefix(newCommitId, "0000000") if isDel { log.GitLogger.Info("del rev", refName, "from", userName+"/"+repoName+".git", "by", userId) - return + return nil } repo, err := git.OpenRepository(f) if err != nil { - log.GitLogger.Fatal("runUpdate.Open repoId: %v", err) + return fmt.Errorf("runUpdate.Open repoId: %v", err) } newCommit, err := repo.GetCommit(newCommitId) if err != nil { - log.GitLogger.Fatal("runUpdate GetCommit of newCommitId: %v", err) - return + return fmt.Errorf("runUpdate GetCommit of newCommitId: %v", err) } var l *list.List @@ -50,28 +50,27 @@ func Update(refName, oldCommitId, newCommitId, userName, repoUserName, repoName if isNew { l, err = newCommit.CommitsBefore() if err != nil { - log.GitLogger.Fatal("Find CommitsBefore erro: %v", err) + return fmt.Errorf("Find CommitsBefore erro: %v", err) } } else { l, err = newCommit.CommitsBeforeUntil(oldCommitId) if err != nil { - log.GitLogger.Fatal("Find CommitsBeforeUntil erro: %v", err) - return + return fmt.Errorf("Find CommitsBeforeUntil erro: %v", err) } } if err != nil { - log.GitLogger.Fatal("runUpdate.Commit repoId: %v", err) + return fmt.Errorf("runUpdate.Commit repoId: %v", err) } ru, err := GetUserByName(repoUserName) if err != nil { - log.GitLogger.Fatal("runUpdate.GetUserByName: %v", err) + return fmt.Errorf("runUpdate.GetUserByName: %v", err) } repos, err := GetRepositoryByName(ru.Id, repoName) if err != nil { - log.GitLogger.Fatal("runUpdate.GetRepositoryByName userId: %v", err) + return fmt.Errorf("runUpdate.GetRepositoryByName userId: %v", err) } commits := make([]*base.PushCommit, 0) @@ -95,6 +94,7 @@ func Update(refName, oldCommitId, newCommitId, userName, repoUserName, repoName //commits = append(commits, []string{lastCommit.Id().String(), lastCommit.Message()}) if err = CommitRepoAction(userId, ru.Id, userName, actEmail, repos.Id, repoUserName, repoName, refName, &base.PushCommits{l.Len(), commits}); err != nil { - log.GitLogger.Fatal("runUpdate.models.CommitRepoAction: %s/%s:%v", repoUserName, repoName, err) + return fmt.Errorf("runUpdate.models.CommitRepoAction: %s/%s:%v", repoUserName, repoName, err) } + return nil } diff --git a/routers/repo/http.go b/routers/repo/http.go index 5915e8761..d2bff2997 100644 --- a/routers/repo/http.go +++ b/routers/repo/http.go @@ -141,7 +141,10 @@ func Http(ctx *middleware.Context, params martini.Params) { newCommitId := fields[1] refName := fields[2] - models.Update(refName, oldCommitId, newCommitId, authUsername, username, reponame, authUser.Id) + if err = models.Update(refName, oldCommitId, newCommitId, authUsername, username, reponame, authUser.Id); err != nil { + log.GitLogger.Error(err.Error()) + return + } } } } diff --git a/templates/VERSION b/templates/VERSION index 414dc2efe..ca3b3f1ba 100644 --- a/templates/VERSION +++ b/templates/VERSION @@ -1 +1 @@ -0.4.5.0622 Alpha \ No newline at end of file +0.4.5.0623 Alpha \ No newline at end of file From 98f614a58e984b386a464bc687086e096f03026a Mon Sep 17 00:00:00 2001 From: Unknown Date: Mon, 23 Jun 2014 19:16:09 -0400 Subject: [PATCH 09/23] Work on #249 issue1 --- routers/user/home.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/routers/user/home.go b/routers/user/home.go index 7d0333cb4..0f2cee256 100644 --- a/routers/user/home.go +++ b/routers/user/home.go @@ -67,7 +67,7 @@ func Profile(ctx *middleware.Context, params martini.Params) { ctx.Data["Title"] = "Profile" ctx.Data["PageIsUserProfile"] = true - user, err := models.GetUserByName(params["username"]) + u, err := models.GetUserByName(params["username"]) if err != nil { if err == models.ErrUserNotExist { ctx.Handle(404, "user.Profile(GetUserByName)", err) @@ -76,19 +76,23 @@ func Profile(ctx *middleware.Context, params martini.Params) { } return } - ctx.Data["Owner"] = user + // For security reason, hide e-mail address for anonymous visitors. + if !ctx.IsSigned { + u.Email = "" + } + ctx.Data["Owner"] = u tab := ctx.Query("tab") ctx.Data["TabName"] = tab switch tab { case "activity": - ctx.Data["Feeds"], err = models.GetFeeds(user.Id, 0, true) + ctx.Data["Feeds"], err = models.GetFeeds(u.Id, 0, true) if err != nil { ctx.Handle(500, "user.Profile(GetFeeds)", err) return } default: - ctx.Data["Repos"], err = models.GetRepositories(user.Id, ctx.IsSigned && ctx.User.Id == user.Id) + ctx.Data["Repos"], err = models.GetRepositories(u.Id, ctx.IsSigned && ctx.User.Id == u.Id) if err != nil { ctx.Handle(500, "user.Profile(GetRepositories)", err) return From b2801a2e985f11e940a0cd420cea57242ea26d4c Mon Sep 17 00:00:00 2001 From: Unknown Date: Tue, 24 Jun 2014 13:55:47 -0400 Subject: [PATCH 10/23] Fix #165 --- README.md | 3 - README_ZH.md | 3 - conf/app.ini | 4 +- gogs.go | 2 +- modules/auth/user.go | 28 ++- modules/bin/conf.go | 471 ++++++++++++++++++------------------ modules/setting/setting.go | 14 +- routers/admin/admin.go | 2 +- templates/VERSION | 2 +- templates/admin/config.tmpl | 4 +- 10 files changed, 264 insertions(+), 269 deletions(-) diff --git a/README.md b/README.md index 847844f38..af33b0e8e 100644 --- a/README.md +++ b/README.md @@ -75,9 +75,6 @@ There are 5 ways to install Gogs: The [core team](http://gogs.io/team) of this project. See [contributors page](https://github.com/gogits/gogs/graphs/contributors) for full list of contributors. -[![Clone in Koding](http://learn.koding.com/btn/clone_d.png)][koding] -[koding]: https://koding.com/Teamwork?import=https://github.com/gogits/gogs/archive/master.zip&c=git1 - ## License This project is under the MIT License. See the [LICENSE](https://github.com/gogits/gogs/blob/master/LICENSE) file for the full license text. diff --git a/README_ZH.md b/README_ZH.md index f67cf037a..26746ccbe 100644 --- a/README_ZH.md +++ b/README_ZH.md @@ -66,9 +66,6 @@ Gogs 完全使用 Go 语言来实现对 Git 数据的操作,实现 **零** 依 本项目的 [开发团队](http://gogs.io/team)。您可以通过查看 [贡献者页面](https://github.com/gogits/gogs/graphs/contributors) 获取完整的贡献者列表。 -[![Clone in Koding](http://learn.koding.com/btn/clone_d.png)][koding] -[koding]: https://koding.com/Teamwork?import=https://github.com/gogits/gogs/archive/master.zip&c=git1 - ## 授权许可 本项目采用 MIT 开源授权许可证,完整的授权说明已放置在 [LICENSE](https://github.com/gogits/gogs/blob/master/LICENSE) 文件中。 \ No newline at end of file diff --git a/conf/app.ini b/conf/app.ini index 111261db9..296509f72 100644 --- a/conf/app.ini +++ b/conf/app.ini @@ -51,8 +51,8 @@ SECRET_KEY = !#@FDEWREWR&*( LOGIN_REMEMBER_DAYS = 7 COOKIE_USERNAME = gogs_awesome COOKIE_REMEMBER_NAME = gogs_incredible -; Reverse proxy authentication header name of user ID -REVERSE_PROXY_AUTHENTICATION_UID = X-WEBAUTH-UID +; Reverse proxy authentication header name of user name +REVERSE_PROXY_AUTHENTICATION_USER = X-WEBAUTH-USER [service] ACTIVE_CODE_LIVE_MINUTES = 180 diff --git a/gogs.go b/gogs.go index a39d2d433..75d3eb4b8 100644 --- a/gogs.go +++ b/gogs.go @@ -17,7 +17,7 @@ import ( "github.com/gogits/gogs/modules/setting" ) -const APP_VER = "0.4.5.0623 Alpha" +const APP_VER = "0.4.5.0624 Alpha" func init() { runtime.GOMAXPROCS(runtime.NumCPU()) diff --git a/modules/auth/user.go b/modules/auth/user.go index 284a4644d..20f993362 100644 --- a/modules/auth/user.go +++ b/modules/auth/user.go @@ -25,23 +25,25 @@ func SignedInId(header http.Header, sess session.SessionStore) int64 { return 0 } - var id int64 if setting.Service.EnableReverseProxyAuth { - id, _ = base.StrTo(header.Get(setting.ReverseProxyAuthUid)).Int64() - } - - if id <= 0 { - uid := sess.Get("userId") - if uid == nil { - return 0 - } - var ok bool - if id, ok = uid.(int64); !ok { - return 0 + webAuthUser := header.Get(setting.ReverseProxyAuthUser) + if len(webAuthUser) > 0 { + u, err := models.GetUserByName(webAuthUser) + if err != nil { + if err != models.ErrUserNotExist { + log.Error("auth.user.SignedInId(GetUserByName): %v", err) + } + return 0 + } + return u.Id } } - if id > 0 { + uid := sess.Get("userId") + if uid == nil { + return 0 + } + if id, ok := uid.(int64); ok { if _, err := models.GetUserById(id); err != nil { if err != models.ErrUserNotExist { log.Error("auth.user.SignedInId(GetUserById): %v", err) diff --git a/modules/bin/conf.go b/modules/bin/conf.go index 71a9fac81..fa0822d73 100644 --- a/modules/bin/conf.go +++ b/modules/bin/conf.go @@ -28,242 +28,241 @@ func bindata_read(data []byte, name string) ([]byte, error) { func conf_app_ini() ([]byte, error) { return bindata_read([]byte{ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x00, 0xff, 0xb4, 0x59, - 0xdd, 0x72, 0xdb, 0xc8, 0xb1, 0xbe, 0xc7, 0x53, 0x8c, 0x79, 0x76, 0xcf, - 0xda, 0xa7, 0x24, 0x92, 0x92, 0x8f, 0x65, 0xaf, 0xbc, 0xae, 0x63, 0x8a, - 0x04, 0x25, 0x1c, 0xf3, 0x47, 0x0b, 0x40, 0xf2, 0x2a, 0x2e, 0x15, 0x0a, - 0x02, 0x86, 0xe4, 0x44, 0x00, 0x06, 0xc2, 0x0c, 0x45, 0x31, 0x77, 0x79, - 0x85, 0x54, 0x9e, 0x26, 0xcf, 0x93, 0x8b, 0x3c, 0x46, 0xbe, 0x1e, 0x00, - 0x14, 0x28, 0x73, 0xb5, 0xce, 0x5f, 0x25, 0x65, 0x11, 0xf3, 0xd3, 0xd3, - 0xdd, 0xf3, 0xf5, 0xd7, 0xdd, 0xb3, 0xef, 0x59, 0x2f, 0xcf, 0x59, 0x16, - 0xa6, 0x9c, 0xe9, 0x45, 0xa8, 0x99, 0x5a, 0xc8, 0x95, 0x62, 0x32, 0x63, - 0xfc, 0x9e, 0x17, 0x6b, 0x96, 0x87, 0x73, 0x4c, 0x08, 0x9d, 0x70, 0xab, - 0x77, 0x7e, 0x1e, 0x4c, 0x7a, 0x63, 0x9b, 0x7d, 0x60, 0xa7, 0x72, 0xae, - 0x8e, 0xf1, 0x2f, 0x3b, 0x15, 0x9a, 0x79, 0xbc, 0xb8, 0x17, 0x51, 0x39, - 0x3f, 0x9a, 0x9e, 0x4e, 0x31, 0x2f, 0xd2, 0x79, 0x67, 0x16, 0x62, 0x54, - 0x66, 0xed, 0x3c, 0x9b, 0x5b, 0xef, 0x59, 0x7f, 0x11, 0x66, 0x90, 0x84, - 0xe5, 0x62, 0xc6, 0xd6, 0x72, 0xc9, 0x8a, 0x65, 0xc6, 0x12, 0x19, 0x85, - 0x49, 0xb2, 0xb6, 0xdc, 0x8b, 0x49, 0x70, 0xe1, 0xd9, 0x2e, 0x76, 0xce, - 0x85, 0xc6, 0x6a, 0x5b, 0xe8, 0x05, 0x2f, 0x58, 0x2b, 0xe6, 0xf7, 0xad, - 0x3d, 0xd6, 0xca, 0x0b, 0x19, 0xb7, 0x98, 0xc4, 0x80, 0xe6, 0x4a, 0x63, - 0x24, 0xe6, 0xb3, 0x70, 0x99, 0x40, 0x96, 0x2a, 0xd7, 0x18, 0x09, 0xe3, - 0xe9, 0x80, 0x74, 0xc3, 0xb7, 0x65, 0x7d, 0x29, 0x78, 0x2e, 0x95, 0xd0, - 0xb2, 0x58, 0x5f, 0x5b, 0xee, 0x74, 0xea, 0x63, 0xc2, 0xf2, 0xfa, 0xae, - 0x73, 0xee, 0x07, 0xfe, 0xd5, 0x39, 0xad, 0xbb, 0x09, 0xd5, 0x02, 0x0b, - 0x15, 0xb4, 0xe7, 0xc5, 0xb5, 0x75, 0xee, 0x4e, 0xfd, 0x69, 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 0x9b, 0xe1, 0x9e, 0x0b, 0x3e, 0x17, 0x4a, 0x97, 0x51, 0x0b, - 0x99, 0xa7, 0x8e, 0x47, 0x3c, 0x62, 0x83, 0xd0, 0x46, 0x90, 0x3a, 0x19, - 0x3a, 0xee, 0xb8, 0x71, 0x8d, 0x03, 0xc9, 0x15, 0xcb, 0xa4, 0x66, 0xa0, - 0x6e, 0xb9, 0xaa, 0x36, 0xe3, 0x00, 0x8a, 0x37, 0x03, 0x06, 0x06, 0x87, - 0x99, 0x00, 0x8c, 0x22, 0xb9, 0xcc, 0x74, 0x09, 0x9e, 0x0d, 0x49, 0x19, - 0xf1, 0xae, 0xb1, 0xbe, 0x21, 0xd4, 0xa8, 0x98, 0x22, 0xc0, 0x99, 0x12, - 0x73, 0x43, 0x7b, 0x50, 0xf5, 0x5e, 0xf0, 0x15, 0xc4, 0xae, 0xf5, 0x42, - 0x64, 0xf3, 0x36, 0x34, 0xfb, 0xf9, 0xc2, 0x71, 0xed, 0xc0, 0x73, 0x4e, - 0x27, 0xb8, 0xe5, 0x4b, 0xc7, 0xfe, 0xdc, 0x90, 0xd0, 0x0f, 0x23, 0x84, - 0x73, 0x78, 0x0f, 0x74, 0x42, 0x17, 0xc5, 0x72, 0x11, 0xe9, 0x65, 0xc1, - 0x2d, 0x7b, 0x62, 0xce, 0xed, 0xf7, 0xfa, 0x67, 0x76, 0xd0, 0xbb, 0x04, - 0xc6, 0xdc, 0xc6, 0xae, 0x31, 0xf9, 0x00, 0xc6, 0x88, 0x59, 0x75, 0x8b, - 0xf5, 0xfa, 0xc9, 0xd4, 0x77, 0x86, 0x57, 0x01, 0xf9, 0xa0, 0xb9, 0x5c, - 0x82, 0x27, 0x62, 0xae, 0xb1, 0xeb, 0xd8, 0xa4, 0x09, 0x22, 0x7f, 0xa4, - 0xac, 0xc5, 0xf2, 0x86, 0xf8, 0x8c, 0xc2, 0x42, 0x68, 0x55, 0xb2, 0xaa, - 0x50, 0x6a, 0xc9, 0x55, 0xe7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 0x66, 0xa0, 0xab, 0xa5, 0x79, 0xe0, 0x80, 0x28, 0x05, 0x29, 0xb8, - 0x60, 0xd2, 0x73, 0x4b, 0x86, 0x71, 0x37, 0x1c, 0x3e, 0xee, 0xfd, 0x12, - 0xd0, 0xfb, 0xa0, 0x57, 0x5f, 0x81, 0xb9, 0x04, 0x12, 0xa4, 0xc0, 0xd4, - 0x08, 0x34, 0x31, 0xd3, 0xcf, 0xc9, 0x39, 0x7c, 0x87, 0x74, 0x12, 0x66, - 0x10, 0xc8, 0x7e, 0xfa, 0x09, 0x5f, 0x7b, 0x0c, 0xf1, 0x3c, 0x3e, 0x31, - 0x72, 0x3d, 0xe7, 0x77, 0x60, 0xa8, 0x33, 0x67, 0x68, 0x1e, 0x2b, 0xdf, - 0x99, 0x80, 0x9d, 0xa7, 0x54, 0xef, 0x91, 0xd5, 0x31, 0x2a, 0xeb, 0xf5, - 0xd7, 0x76, 0x0d, 0xd0, 0x3e, 0x5f, 0x7d, 0x65, 0x99, 0xfd, 0x90, 0x0b, - 0x64, 0x14, 0xf3, 0x64, 0x43, 0xea, 0x90, 0x00, 0xd2, 0xe5, 0x65, 0xcc, - 0x13, 0x4e, 0x0f, 0x07, 0x33, 0x7a, 0x4f, 0x48, 0xa1, 0x36, 0xad, 0xd8, - 0x76, 0xd7, 0x5b, 0xa3, 0xcc, 0xe6, 0x61, 0xa7, 0x81, 0x80, 0x6c, 0xd7, - 0xf5, 0x67, 0x8d, 0xfb, 0xa4, 0xe7, 0x9b, 0x2a, 0xeb, 0x97, 0x29, 0x9f, - 0xde, 0x3e, 0xca, 0x57, 0xee, 0xca, 0x21, 0x29, 0x28, 0x28, 0x9c, 0xf3, - 0x1d, 0xe4, 0xee, 0xda, 0x48, 0x2e, 0x13, 0x34, 0xa4, 0x01, 0x28, 0x67, - 0xec, 0x35, 0x5f, 0x58, 0x7d, 0xec, 0x47, 0x1c, 0x16, 0x1b, 0xd9, 0xab, - 0x05, 0xcf, 0x9a, 0xe5, 0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, 0x08, 0x62, 0x52, 0x29, 0x80, 0xb8, + 0x54, 0xd5, 0x87, 0xe5, 0xda, 0x97, 0xb6, 0xeb, 0xd9, 0x01, 0x52, 0xc6, + 0x2f, 0x57, 0x41, 0xef, 0xc2, 0x3f, 0xb3, 0x27, 0x00, 0x16, 0xc0, 0x35, + 0xdd, 0xe4, 0xbd, 0x5f, 0xf6, 0x3f, 0xdb, 0x27, 0xb4, 0xb5, 0x4f, 0x0b, + 0x55, 0x5e, 0x02, 0x50, 0xae, 0xad, 0x5e, 0xdf, 0x77, 0x2e, 0xed, 0xa0, + 0x0f, 0x0f, 0x05, 0x23, 0xfa, 0x35, 0x76, 0x26, 0x08, 0x74, 0x52, 0xec, + 0xe0, 0x5d, 0x17, 0xcc, 0x3d, 0x9b, 0xe0, 0x49, 0x80, 0xf8, 0xd5, 0x43, + 0x88, 0x12, 0x23, 0x0d, 0xe7, 0x31, 0xd3, 0x92, 0x21, 0x2d, 0xcf, 0x44, + 0x91, 0x32, 0xbe, 0x9f, 0x86, 0x22, 0x61, 0x33, 0xf8, 0xba, 0xe0, 0x73, + 0xa1, 0x74, 0x19, 0xb9, 0xe0, 0x79, 0xea, 0x78, 0x94, 0x4b, 0x6c, 0x24, + 0xb5, 0x11, 0xb8, 0x4e, 0x86, 0x8e, 0x3b, 0x6e, 0xb8, 0x72, 0x20, 0xb9, + 0x62, 0x99, 0xd4, 0x0c, 0xe9, 0x5b, 0xae, 0x2a, 0x62, 0x5c, 0x40, 0x31, + 0x67, 0x00, 0xc1, 0x60, 0x34, 0x13, 0x84, 0x51, 0x24, 0x97, 0x99, 0x2e, + 0x01, 0xb4, 0x49, 0x54, 0x86, 0xbd, 0x6b, 0xf4, 0x6f, 0x30, 0x35, 0x22, + 0xa6, 0x08, 0x72, 0xa6, 0xc4, 0xdc, 0xa4, 0x3e, 0x88, 0x7a, 0x2f, 0xf8, + 0x0a, 0x6c, 0xd7, 0x7a, 0x21, 0xb2, 0x79, 0x1b, 0x92, 0xfd, 0x7c, 0xe1, + 0xb8, 0x76, 0xe0, 0x39, 0xa7, 0x13, 0x78, 0xfa, 0xd2, 0xb1, 0x3f, 0x37, + 0x38, 0xf4, 0xc3, 0x08, 0x21, 0x1d, 0xde, 0x03, 0xa1, 0x90, 0x45, 0xb1, + 0x5c, 0x44, 0x7a, 0x59, 0x70, 0xcb, 0x9e, 0x98, 0x7b, 0xfb, 0xbd, 0xfe, + 0x99, 0x1d, 0xf4, 0x2e, 0x81, 0x33, 0xb7, 0x41, 0x35, 0x26, 0x1b, 0x40, + 0x19, 0x31, 0xab, 0x3c, 0x59, 0x9f, 0x9f, 0x4c, 0x7d, 0x67, 0x78, 0x15, + 0x90, 0x0d, 0x9a, 0xc7, 0x25, 0x72, 0x45, 0xcc, 0x35, 0xa8, 0x8e, 0x4d, + 0xa9, 0xa0, 0x02, 0x80, 0xb2, 0xb5, 0x58, 0xde, 0x50, 0x4e, 0xa3, 0xd0, + 0x10, 0x5a, 0x95, 0x99, 0x55, 0x28, 0xb5, 0xe4, 0xaa, 0x73, 0x70, 0xf4, + 0xa6, 0xe6, 0xf9, 0x1c, 0x16, 0x36, 0x97, 0x58, 0x5f, 0x56, 0xfc, 0x66, + 0x21, 0xe5, 0x2d, 0xe5, 0x98, 0x7e, 0x01, 0x6c, 0xe9, 0x50, 0xdd, 0xc2, + 0x22, 0xb0, 0xf1, 0x7d, 0x98, 0x90, 0x69, 0x60, 0x63, 0xe4, 0x28, 0x65, + 0xf9, 0x3d, 0xef, 0x53, 0xe0, 0x4c, 0xe0, 0xac, 0xcb, 0x1e, 0x49, 0x79, + 0x40, 0xde, 0xe1, 0x89, 0x00, 0x4e, 0x51, 0xb6, 0x53, 0x2e, 0x97, 0x9a, + 0x8e, 0x23, 0x38, 0x65, 0x16, 0x2b, 0x6b, 0x60, 0x13, 0x3a, 0xdc, 0xc0, + 0x77, 0xc6, 0x36, 0xca, 0x05, 0x08, 0xde, 0xe0, 0x36, 0x42, 0x01, 0xd5, + 0xc0,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, 0x1e, 0xe6, + 0xd4, 0x51, 0x20, 0xff, 0x45, 0x61, 0xc6, 0x6e, 0x48, 0x4d, 0x4e, 0xe6, + 0x43, 0x93, 0xc4, 0xab, 0x9c, 0xf8, 0xa5, 0x75, 0xf0, 0xb1, 0xf1, 0x10, + 0xdd, 0xda, 0x6b, 0x1d, 0x6e, 0x7d, 0x5f, 0x93, 0x5f, 0x6c, 0x7a, 0x2a, + 0xf1, 0x9a, 0xa6, 0xdb, 0xe4, 0xe5, 0xa7, 0xe6, 0x7b, 0x7c, 0x14, 0x6e, + 0x98, 0x70, 0xfb, 0x75, 0x98, 0x6d, 0x3d, 0xd4, 0x5a, 0x03, 0x97, 0xb8, + 0x97, 0x07, 0x4f, 0x40, 0x19, 0xd3, 0x7f, 0x73, 0x79, 0x90, 0x45, 0x5a, + 0x4a, 0x78, 0x6c, 0x1e, 0x7a, 0x8f, 0xe9, 0x9f, 0x8f, 0x9b, 0xff, 0x02, + 0x61, 0xd2, 0xcf, 0xff, 0x21, 0x3b, 0x17, 0xe8, 0x24, 0x3e, 0x2c, 0xf5, + 0xec, 0x9d, 0x45, 0xe0, 0x21, 0x26, 0x7f, 0x0f, 0x00, 0x00, 0xff, 0xff, + 0xc9, 0x2e, 0x07, 0x65, 0xc7, 0x19, 0x00, 0x00, }, "conf/app.ini", ) diff --git a/modules/setting/setting.go b/modules/setting/setting.go index cb7734bb3..f03aa8aea 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -47,12 +47,12 @@ var ( StaticRootPath string // Security settings. - InstallLock bool - SecretKey string - LogInRememberDays int - CookieUserName string - CookieRememberName string - ReverseProxyAuthUid string + InstallLock bool + SecretKey string + LogInRememberDays int + CookieUserName string + CookieRememberName string + ReverseProxyAuthUser string // Webhook settings. WebhookTaskInterval int @@ -164,7 +164,7 @@ func NewConfigContext() { LogInRememberDays = Cfg.MustInt("security", "LOGIN_REMEMBER_DAYS") CookieUserName = Cfg.MustValue("security", "COOKIE_USERNAME") CookieRememberName = Cfg.MustValue("security", "COOKIE_REMEMBER_NAME") - ReverseProxyAuthUid = Cfg.MustValue("security", "REVERSE_PROXY_AUTHENTICATION_UID", "X-WEBAUTH-UID") + ReverseProxyAuthUser = Cfg.MustValue("security", "REVERSE_PROXY_AUTHENTICATION_USER", "X-WEBAUTH-USER") RunUser = Cfg.MustValue("", "RUN_USER") curUser := os.Getenv("USER") diff --git a/routers/admin/admin.go b/routers/admin/admin.go index 140e1e9f6..50a3823a0 100644 --- a/routers/admin/admin.go +++ b/routers/admin/admin.go @@ -206,7 +206,7 @@ func Config(ctx *middleware.Context) { ctx.Data["StaticRootPath"] = setting.StaticRootPath ctx.Data["LogRootPath"] = setting.LogRootPath ctx.Data["ScriptType"] = setting.ScriptType - ctx.Data["ReverseProxyAuthUid"] = setting.ReverseProxyAuthUid + ctx.Data["ReverseProxyAuthUser"] = setting.ReverseProxyAuthUser ctx.Data["Service"] = setting.Service diff --git a/templates/VERSION b/templates/VERSION index ca3b3f1ba..8c2be60bb 100644 --- a/templates/VERSION +++ b/templates/VERSION @@ -1 +1 @@ -0.4.5.0623 Alpha \ No newline at end of file +0.4.5.0624 Alpha \ No newline at end of file diff --git a/templates/admin/config.tmpl b/templates/admin/config.tmpl index 22be5900e..10a53b539 100644 --- a/templates/admin/config.tmpl +++ b/templates/admin/config.tmpl @@ -36,8 +36,8 @@
{{.LogRootPath}}
Script Type
{{.ScriptType}}
-
Reverse Authentication UID
-
{{.ReverseProxyAuthUid}}
+
Reverse Authentication User
+
{{.ReverseProxyAuthUser}}
From cc703ee6631e9a559fc3a72bf97d68c8fd5ebd10 Mon Sep 17 00:00:00 2001 From: fuxiaohei Date: Wed, 25 Jun 2014 12:22:08 +0800 Subject: [PATCH 11/23] select owner when creating repository --- public/css/gogs.css | 7 +++++-- templates/repo/create.tmpl | 21 ++++++++++++++++++++- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/public/css/gogs.css b/public/css/gogs.css index 1f465d845..960176f58 100755 --- a/public/css/gogs.css +++ b/public/css/gogs.css @@ -257,6 +257,9 @@ html, body { .card .btn { cursor: pointer; +} + +.card .btn-primary { margin-right: 1.2em; } @@ -638,7 +641,7 @@ html, body { margin: 0 .5em; } -#dashboard-switch .btn { +#dashboard-switch .btn, #repo-owner-switch .btn { height: 40px; } @@ -647,7 +650,7 @@ html, body { margin-right: 18px; } -#dashboard-switch .dropdown-menu { +#dashboard-switch .dropdown-menu,#repo-owner-switch .dropdown-menu { padding: 0; } diff --git a/templates/repo/create.tmpl b/templates/repo/create.tmpl index 6da6a93d1..0d1c42dee 100644 --- a/templates/repo/create.tmpl +++ b/templates/repo/create.tmpl @@ -8,9 +8,28 @@
+
+ + + +
+
+ +
From e0f9c628c5ff7399167944b3d0730698487af498 Mon Sep 17 00:00:00 2001 From: Unknown Date: Wed, 25 Jun 2014 00:44:48 -0400 Subject: [PATCH 12/23] Add create organization --- cmd/serve.go | 20 ++-- cmd/web.go | 5 +- gogs.go | 2 +- models/access.go | 17 ++-- models/issue.go | 4 +- models/login.go | 4 +- models/models.go | 2 +- models/org.go | 69 +++++++++++++ models/repo.go | 10 +- models/user.go | 186 +++++++++++++++++++++++++++------- modules/auth/org.go | 33 ++++++ modules/middleware/repo.go | 4 +- routers/admin/user.go | 4 +- routers/install.go | 2 +- routers/org/org.go | 96 ++++++++++++++++-- routers/repo/http.go | 8 +- routers/repo/setting.go | 4 +- routers/user/home.go | 13 ++- routers/user/user.go | 7 +- templates/VERSION | 2 +- templates/org/dashboard.tmpl | 73 ------------- templates/org/new.tmpl | 24 +---- templates/user/dashboard.tmpl | 39 +++++-- templates/user/issues.tmpl | 3 +- 24 files changed, 436 insertions(+), 195 deletions(-) create mode 100644 models/org.go create mode 100644 modules/auth/org.go delete mode 100644 templates/org/dashboard.tmpl diff --git a/cmd/serve.go b/cmd/serve.go index 62e290d82..2a76da793 100644 --- a/cmd/serve.go +++ b/cmd/serve.go @@ -56,19 +56,19 @@ func parseCmd(cmd string) (string, string) { } var ( - COMMANDS_READONLY = map[string]int{ - "git-upload-pack": models.AU_WRITABLE, - "git upload-pack": models.AU_WRITABLE, - "git-upload-archive": models.AU_WRITABLE, + COMMANDS_READONLY = map[string]models.AccessType{ + "git-upload-pack": models.WRITABLE, + "git upload-pack": models.WRITABLE, + "git-upload-archive": models.WRITABLE, } - COMMANDS_WRITE = map[string]int{ - "git-receive-pack": models.AU_READABLE, - "git receive-pack": models.AU_READABLE, + COMMANDS_WRITE = map[string]models.AccessType{ + "git-receive-pack": models.READABLE, + "git receive-pack": models.READABLE, } ) -func In(b string, sl map[string]int) bool { +func In(b string, sl map[string]models.AccessType) bool { _, e := sl[b] return e } @@ -129,7 +129,7 @@ func runServ(k *cli.Context) { // Access check. switch { case isWrite: - has, err := models.HasAccess(user.Name, path.Join(repoUserName, repoName), models.AU_WRITABLE) + has, err := models.HasAccess(user.Name, path.Join(repoUserName, repoName), models.WRITABLE) if err != nil { println("Gogs: internal error:", err) log.GitLogger.Fatal("Fail to check write access:", err) @@ -152,7 +152,7 @@ func runServ(k *cli.Context) { break } - has, err := models.HasAccess(user.Name, path.Join(repoUserName, repoName), models.AU_READABLE) + has, err := models.HasAccess(user.Name, path.Join(repoUserName, repoName), models.READABLE) if err != nil { println("Gogs: internal error:", err) log.GitLogger.Fatal("Fail to check read access:", err) diff --git a/cmd/web.go b/cmd/web.go index d29183a9d..878fdeac7 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -188,14 +188,15 @@ func runWeb(*cli.Context) { reqOwner := middleware.RequireOwner() - m.Group("/o", func(r martini.Router) { + m.Group("/org", func(r martini.Router) { r.Get("/create", org.New) + r.Post("/create", bindIgnErr(auth.CreateOrganizationForm{}), org.NewPost) r.Get("/:org", org.Organization) r.Get("/:org/dashboard", org.Dashboard) r.Get("/:org/members", org.Members) r.Get("/:org/teams", org.Teams) r.Get("/:org/setting", org.Setting) - }) + }, reqSignIn) m.Group("/:username/:reponame", func(r martini.Router) { r.Get("/settings", repo.Setting) diff --git a/gogs.go b/gogs.go index 75d3eb4b8..5c2c6ed94 100644 --- a/gogs.go +++ b/gogs.go @@ -17,7 +17,7 @@ import ( "github.com/gogits/gogs/modules/setting" ) -const APP_VER = "0.4.5.0624 Alpha" +const APP_VER = "0.4.5.0625 Alpha" func init() { runtime.GOMAXPROCS(runtime.NumCPU()) diff --git a/models/access.go b/models/access.go index cf31fc137..5238daba3 100644 --- a/models/access.go +++ b/models/access.go @@ -11,19 +11,20 @@ import ( "github.com/go-xorm/xorm" ) -// Access types. +type AccessType int + const ( - AU_READABLE = iota + 1 - AU_WRITABLE + READABLE AccessType = iota + 1 + WRITABLE ) // Access represents the accessibility of user to repository. type Access struct { Id int64 - UserName string `xorm:"unique(s)"` - RepoName string `xorm:"unique(s)"` // / - Mode int `xorm:"unique(s)"` - Created time.Time `xorm:"created"` + UserName string `xorm:"unique(s)"` + RepoName string `xorm:"unique(s)"` // / + Mode AccessType `xorm:"unique(s)"` + Created time.Time `xorm:"created"` } // AddAccess adds new access record. @@ -59,7 +60,7 @@ func UpdateAccessWithSession(sess *xorm.Session, access *Access) error { // HasAccess returns true if someone can read or write to given repository. // The repoName should be in format /. -func HasAccess(uname, repoName string, mode int) (bool, error) { +func HasAccess(uname, repoName string, mode AccessType) (bool, error) { if len(repoName) == 0 { return false, nil } diff --git a/models/issue.go b/models/issue.go index 11f6dd4ef..6d67a72bc 100644 --- a/models/issue.go +++ b/models/issue.go @@ -213,9 +213,9 @@ func GetIssueCountByPoster(uid, rid int64, isClosed bool) int64 { // IssueUser represents an issue-user relation. type IssueUser struct { Id int64 - Uid int64 // User ID. + Uid int64 `xorm:"INDEX"` // User ID. IssueId int64 - RepoId int64 + RepoId int64 `xorm:"INDEX"` MilestoneId int64 IsRead bool IsAssigned bool diff --git a/models/login.go b/models/login.go index 98c5c64e4..e99b61e77 100644 --- a/models/login.go +++ b/models/login.go @@ -255,7 +255,7 @@ func LoginUserLdapSource(user *User, name, passwd string, sourceId int64, cfg *L Email: mail, } - return RegisterUser(user) + return CreateUser(user) } type loginAuth struct { @@ -359,5 +359,5 @@ func LoginUserSMTPSource(user *User, name, passwd string, sourceId int64, cfg *S Passwd: passwd, Email: name, } - return RegisterUser(user) + return CreateUser(user) } diff --git a/models/models.go b/models/models.go index d6273d7f9..4e65c00bc 100644 --- a/models/models.go +++ b/models/models.go @@ -35,7 +35,7 @@ func init() { tables = append(tables, new(User), new(PublicKey), new(Repository), new(Watch), new(Action), new(Access), new(Issue), new(Comment), new(Oauth2), new(Follow), new(Mirror), new(Release), new(LoginSource), new(Webhook), new(IssueUser), - new(Milestone), new(Label), new(HookTask)) + new(Milestone), new(Label), new(HookTask), new(Team), new(OrgUser), new(TeamUser)) } func LoadModelsConfig() { diff --git a/models/org.go b/models/org.go new file mode 100644 index 000000000..1cfe17984 --- /dev/null +++ b/models/org.go @@ -0,0 +1,69 @@ +// Copyright 2014 The Gogs Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +package models + +type AuthorizeType int + +const ( + ORG_READABLE AuthorizeType = iota + 1 + ORG_WRITABLE + ORG_ADMIN +) + +// Team represents a organization team. +type Team struct { + Id int64 + OrgId int64 `xorm:"INDEX"` + Name string + Description string + Authorize AuthorizeType + NumMembers int + NumRepos int +} + +// NewTeam creates a record of new team. +func NewTeam(t *Team) error { + _, err := x.Insert(t) + return err +} + +// ________ ____ ___ +// \_____ \_______ ____ | | \______ ___________ +// / | \_ __ \/ ___\| | / ___// __ \_ __ \ +// / | \ | \/ /_/ > | /\___ \\ ___/| | \/ +// \_______ /__| \___ /|______//____ >\___ >__| +// \/ /_____/ \/ \/ + +// OrgUser represents an organization-user relation. +type OrgUser struct { + Id int64 + Uid int64 `xorm:"INDEX"` + OrgId int64 `xorm:"INDEX"` + IsPublic bool + IsOwner bool + NumTeam int +} + +// GetOrgUsersByUserId returns all organization-user relations by user ID. +func GetOrgUsersByUserId(uid int64) ([]*OrgUser, error) { + ous := make([]*OrgUser, 0, 10) + err := x.Where("uid=?", uid).Find(&ous) + return ous, err +} + +// ___________ ____ ___ +// \__ ___/___ _____ _____ | | \______ ___________ +// | |_/ __ \\__ \ / \| | / ___// __ \_ __ \ +// | |\ ___/ / __ \| Y Y \ | /\___ \\ ___/| | \/ +// |____| \___ >____ /__|_| /______//____ >\___ >__| +// \/ \/ \/ \/ \/ + +// TeamUser represents an team-user relation. +type TeamUser struct { + Id int64 + Uid int64 + OrgId int64 `xorm:"INDEX"` + TeamId int64 +} diff --git a/models/repo.go b/models/repo.go index 4ccaccbf8..f0e46c713 100644 --- a/models/repo.go +++ b/models/repo.go @@ -158,7 +158,7 @@ func IsRepositoryExist(u *User, repoName string) (bool, error) { } var ( - illegalEquals = []string{"raw", "install", "api", "avatar", "user", "help", "stars", "issues", "pulls", "commits", "repo", "template", "admin"} + illegalEquals = []string{"raw", "install", "api", "avatar", "user", "org", "help", "stars", "issues", "pulls", "commits", "repo", "template", "admin"} illegalSuffixs = []string{".git"} ) @@ -483,7 +483,9 @@ func CreateRepository(user *User, name, desc, lang, license string, private, mir sess := x.NewSession() defer sess.Close() - sess.Begin() + if err = sess.Begin(); err != nil { + return nil, err + } if _, err = sess.Insert(repo); err != nil { if err2 := os.RemoveAll(repoPath); err2 != nil { @@ -495,9 +497,9 @@ func CreateRepository(user *User, name, desc, lang, license string, private, mir return nil, err } - mode := AU_WRITABLE + mode := WRITABLE if mirror { - mode = AU_READABLE + mode = READABLE } access := Access{ UserName: user.LowerName, diff --git a/models/user.go b/models/user.go index 50d81c942..2388be9a9 100644 --- a/models/user.go +++ b/models/user.go @@ -21,10 +21,11 @@ import ( "github.com/gogits/gogs/modules/setting" ) -// User types. +type UserType int + const ( - UT_INDIVIDUAL = iota + 1 - UT_ORGANIZATION + INDIVIDUAL UserType = iota // Historic reason to make it starts at 0. + ORGANIZATION ) var ( @@ -50,7 +51,8 @@ type User struct { LoginType LoginType LoginSource int64 `xorm:"not null default 0"` LoginName string - Type int + Type UserType + Orgs []*User `xorm:"-"` NumFollowers int NumFollowings int NumStars int @@ -65,36 +67,60 @@ type User struct { Salt string `xorm:"VARCHAR(10)"` Created time.Time `xorm:"created"` Updated time.Time `xorm:"updated"` + + // For organization. + NumTeams int + NumMembers int } // HomeLink returns the user home page link. -func (user *User) HomeLink() string { - return "/user/" + user.Name +func (u *User) HomeLink() string { + return "/user/" + u.Name } // AvatarLink returns user gravatar link. -func (user *User) AvatarLink() string { +func (u *User) AvatarLink() string { if setting.DisableGravatar { return "/img/avatar_default.jpg" } else if setting.Service.EnableCacheAvatar { - return "/avatar/" + user.Avatar + return "/avatar/" + u.Avatar } - return "//1.gravatar.com/avatar/" + user.Avatar + return "//1.gravatar.com/avatar/" + u.Avatar } // NewGitSig generates and returns the signature of given user. -func (user *User) NewGitSig() *git.Signature { +func (u *User) NewGitSig() *git.Signature { return &git.Signature{ - Name: user.Name, - Email: user.Email, + Name: u.Name, + Email: u.Email, When: time.Now(), } } // EncodePasswd encodes password to safe format. -func (user *User) EncodePasswd() { - newPasswd := base.PBKDF2([]byte(user.Passwd), []byte(user.Salt), 10000, 50, sha256.New) - user.Passwd = fmt.Sprintf("%x", newPasswd) +func (u *User) EncodePasswd() { + newPasswd := base.PBKDF2([]byte(u.Passwd), []byte(u.Salt), 10000, 50, sha256.New) + u.Passwd = fmt.Sprintf("%x", newPasswd) +} + +func (u *User) IsOrganization() bool { + return u.Type == ORGANIZATION +} + +func (u *User) GetOrganizations() error { + ous, err := GetOrgUsersByUserId(u.Id) + if err != nil { + return err + } + + u.Orgs = make([]*User, len(ous)) + for i, ou := range ous { + u.Orgs[i], err = GetUserById(ou.OrgId) + if err != nil { + return err + } + } + return nil } // Member represents user is member of organization. @@ -126,49 +152,135 @@ func GetUserSalt() string { return base.GetRandomString(10) } -// RegisterUser creates record of a new user. -func RegisterUser(user *User) (*User, error) { +// CreateUser creates record of a new user. +func CreateUser(u *User) (*User, error) { + if !IsLegalName(u.Name) { + return nil, ErrUserNameIllegal + } + + isExist, err := IsUserExist(u.Name) + if err != nil { + return nil, err + } else if isExist { + return nil, ErrUserAlreadyExist + } + + isExist, err = IsEmailUsed(u.Email) + if err != nil { + return nil, err + } else if isExist { + return nil, ErrEmailAlreadyUsed + } + + u.LowerName = strings.ToLower(u.Name) + u.Avatar = base.EncodeMd5(u.Email) + u.AvatarEmail = u.Email + u.Rands = GetUserSalt() + u.Salt = GetUserSalt() + u.EncodePasswd() + + sess := x.NewSession() + defer sess.Close() + if err = sess.Begin(); err != nil { + return nil, err + } - if !IsLegalName(user.Name) { + if _, err = sess.Insert(u); err != nil { + sess.Rollback() + return nil, err + } + + if err = os.MkdirAll(UserPath(u.Name), os.ModePerm); err != nil { + sess.Rollback() + return nil, err + } + + if err = sess.Commit(); err != nil { + return nil, err + } + + // Auto-set admin for user whose ID is 1. + if u.Id == 1 { + u.IsAdmin = true + u.IsActive = true + _, err = x.Id(u.Id).UseBool().Update(u) + } + return u, err +} + +// CreateOrganization creates record of a new organization. +func CreateOrganization(org, owner *User) (*User, error) { + if !IsLegalName(org.Name) { return nil, ErrUserNameIllegal } - isExist, err := IsUserExist(user.Name) + isExist, err := IsUserExist(org.Name) if err != nil { return nil, err } else if isExist { return nil, ErrUserAlreadyExist } - isExist, err = IsEmailUsed(user.Email) + isExist, err = IsEmailUsed(org.Email) if err != nil { return nil, err } else if isExist { return nil, ErrEmailAlreadyUsed } - user.LowerName = strings.ToLower(user.Name) - user.Avatar = base.EncodeMd5(user.Email) - user.AvatarEmail = user.Email - user.Rands = GetUserSalt() - user.Salt = GetUserSalt() - user.EncodePasswd() - if _, err = x.Insert(user); err != nil { + org.LowerName = strings.ToLower(org.Name) + org.Avatar = base.EncodeMd5(org.Email) + org.AvatarEmail = org.Email + // No password for organization. + org.NumTeams = 1 + org.NumMembers = 1 + + sess := x.NewSession() + defer sess.Close() + if err = sess.Begin(); err != nil { + return nil, err + } + + if _, err = sess.Insert(org); err != nil { + sess.Rollback() return nil, err - } else if err = os.MkdirAll(UserPath(user.Name), os.ModePerm); err != nil { - if _, err := x.Id(user.Id).Delete(&User{}); err != nil { - return nil, errors.New(fmt.Sprintf( - "both create userpath %s and delete table record faild: %v", user.Name, err)) - } + } + + // Create default owner team. + t := &Team{ + OrgId: org.Id, + Name: "Owner", + Authorize: ORG_ADMIN, + NumMembers: 1, + } + if _, err = sess.Insert(t); err != nil { + sess.Rollback() return nil, err } - if user.Id == 1 { - user.IsAdmin = true - user.IsActive = true - _, err = x.Id(user.Id).UseBool().Update(user) + // Add initial creator to organization and owner team. + ou := &OrgUser{ + Uid: owner.Id, + OrgId: org.Id, + IsOwner: true, + NumTeam: 1, } - return user, err + if _, err = sess.Insert(ou); err != nil { + sess.Rollback() + return nil, err + } + + tu := &TeamUser{ + Uid: owner.Id, + OrgId: org.Id, + TeamId: t.Id, + } + if _, err = sess.Insert(tu); err != nil { + sess.Rollback() + return nil, err + } + + return org, sess.Commit() } // GetUsers returns given number of user objects with offset. diff --git a/modules/auth/org.go b/modules/auth/org.go new file mode 100644 index 000000000..a60fbb851 --- /dev/null +++ b/modules/auth/org.go @@ -0,0 +1,33 @@ +// Copyright 2014 The Gogs Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +package auth + +import ( + "net/http" + "reflect" + + "github.com/go-martini/martini" + + "github.com/gogits/gogs/modules/base" + "github.com/gogits/gogs/modules/middleware/binding" +) + +type CreateOrganizationForm struct { + OrgName string `form:"orgname" binding:"Required;AlphaDashDot;MaxSize(30)"` + Email string `form:"email" binding:"Required;Email;MaxSize(50)"` +} + +func (f *CreateOrganizationForm) Name(field string) string { + names := map[string]string{ + "OrgName": "Organization name", + "Email": "E-mail address", + } + return names[field] +} + +func (f *CreateOrganizationForm) Validate(errs *binding.Errors, req *http.Request, ctx martini.Context) { + data := ctx.Get(reflect.TypeOf(base.TmplData{})).Interface().(base.TmplData) + validate(errs, data, f) +} diff --git a/modules/middleware/repo.go b/modules/middleware/repo.go index 6c77ed2a7..43ba1e8c5 100644 --- a/modules/middleware/repo.go +++ b/modules/middleware/repo.go @@ -46,7 +46,7 @@ func RepoAssignment(redirect bool, args ...bool) martini.Handler { // Collaborators who have write access can be seen as owners. if ctx.IsSigned { - ctx.Repo.IsOwner, err = models.HasAccess(ctx.User.Name, userName+"/"+repoName, models.AU_WRITABLE) + ctx.Repo.IsOwner, err = models.HasAccess(ctx.User.Name, userName+"/"+repoName, models.WRITABLE) if err != nil { ctx.Handle(500, "RepoAssignment(HasAccess)", err) return @@ -107,7 +107,7 @@ func RepoAssignment(redirect bool, args ...bool) martini.Handler { return } - hasAccess, err := models.HasAccess(ctx.User.Name, ctx.Repo.Owner.Name+"/"+repo.Name, models.AU_READABLE) + hasAccess, err := models.HasAccess(ctx.User.Name, ctx.Repo.Owner.Name+"/"+repo.Name, models.READABLE) if err != nil { ctx.Handle(500, "RepoAssignment(HasAccess)", err) return diff --git a/routers/admin/user.go b/routers/admin/user.go index d1bbb4806..cf99db2bf 100644 --- a/routers/admin/user.go +++ b/routers/admin/user.go @@ -67,7 +67,7 @@ func NewUserPost(ctx *middleware.Context, form auth.RegisterForm) { } var err error - if u, err = models.RegisterUser(u); err != nil { + if u, err = models.CreateUser(u); err != nil { switch err { case models.ErrUserAlreadyExist: ctx.RenderWithErr("Username has been already taken", USER_NEW, &form) @@ -76,7 +76,7 @@ func NewUserPost(ctx *middleware.Context, form auth.RegisterForm) { case models.ErrUserNameIllegal: ctx.RenderWithErr(models.ErrRepoNameIllegal.Error(), USER_NEW, &form) default: - ctx.Handle(500, "admin.user.NewUser(RegisterUser)", err) + ctx.Handle(500, "admin.user.NewUser(CreateUser)", err) } return } diff --git a/routers/install.go b/routers/install.go index 6ce7c9802..bb3c16eae 100644 --- a/routers/install.go +++ b/routers/install.go @@ -227,7 +227,7 @@ func InstallPost(ctx *middleware.Context, form auth.InstallForm) { GlobalInit() // Create admin account. - if _, err := models.RegisterUser(&models.User{Name: form.AdminName, Email: form.AdminEmail, Passwd: form.AdminPasswd, + if _, err := models.CreateUser(&models.User{Name: form.AdminName, Email: form.AdminEmail, Passwd: form.AdminPasswd, IsAdmin: true, IsActive: true}); err != nil { if err != models.ErrUserAlreadyExist { setting.InstallLock = false diff --git a/routers/org/org.go b/routers/org/org.go index ff97402eb..0595a81b3 100644 --- a/routers/org/org.go +++ b/routers/org/org.go @@ -1,33 +1,117 @@ +// Copyright 2014 The Gogs Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + package org import ( "github.com/go-martini/martini" + + "github.com/gogits/gogs/models" + "github.com/gogits/gogs/modules/auth" + "github.com/gogits/gogs/modules/base" + "github.com/gogits/gogs/modules/log" "github.com/gogits/gogs/modules/middleware" + "github.com/gogits/gogs/routers/user" +) + +const ( + NEW base.TplName = "org/new" ) func Organization(ctx *middleware.Context, params martini.Params) { - ctx.Data["Title"] = "Organization "+params["org"] + ctx.Data["Title"] = "Organization " + params["org"] ctx.HTML(200, "org/org") } func Members(ctx *middleware.Context, params martini.Params) { - ctx.Data["Title"] = "Organization "+params["org"]+" Members" + ctx.Data["Title"] = "Organization " + params["org"] + " Members" ctx.HTML(200, "org/members") } func Teams(ctx *middleware.Context, params martini.Params) { - ctx.Data["Title"] = "Organization "+params["org"]+" Teams" + ctx.Data["Title"] = "Organization " + params["org"] + " Teams" ctx.HTML(200, "org/teams") } func New(ctx *middleware.Context) { - ctx.Data["Title"] = "Create an Organization" - ctx.HTML(200, "org/new") + ctx.Data["Title"] = "Create An Organization" + ctx.HTML(200, NEW) +} + +func NewPost(ctx *middleware.Context, form auth.CreateOrganizationForm) { + ctx.Data["Title"] = "Create An Organization" + + if ctx.HasError() { + ctx.HTML(200, NEW) + return + } + + org := &models.User{ + Name: form.OrgName, + Email: form.Email, + IsActive: true, // NOTE: may need to set false when require e-mail confirmation. + Type: models.ORGANIZATION, + } + + var err error + if org, err = models.CreateOrganization(org, ctx.User); err != nil { + switch err { + case models.ErrUserAlreadyExist: + ctx.Data["Err_OrgName"] = true + ctx.RenderWithErr("Organization name has been already taken", NEW, &form) + case models.ErrEmailAlreadyUsed: + ctx.Data["Err_Email"] = true + ctx.RenderWithErr("E-mail address has been already used", NEW, &form) + case models.ErrUserNameIllegal: + ctx.Data["Err_OrgName"] = true + ctx.RenderWithErr(models.ErrRepoNameIllegal.Error(), NEW, &form) + default: + ctx.Handle(500, "user.NewPost(CreateUser)", err) + } + return + } + log.Trace("%s Organization created: %s", ctx.Req.RequestURI, org.Name) + + ctx.Redirect("/org/" + form.OrgName + "/dashboard") } func Dashboard(ctx *middleware.Context, params martini.Params) { ctx.Data["Title"] = "Dashboard" - ctx.HTML(200, "org/dashboard") + ctx.Data["PageIsUserDashboard"] = true + ctx.Data["PageIsOrgDashboard"] = true + + org, err := models.GetUserByName(params["org"]) + if err != nil { + if err == models.ErrUserNotExist { + ctx.Handle(404, "org.Dashboard(GetUserByName)", err) + } else { + ctx.Handle(500, "org.Dashboard(GetUserByName)", err) + } + return + } + + if err := ctx.User.GetOrganizations(); err != nil { + ctx.Handle(500, "home.Dashboard(GetOrganizations)", err) + return + } + ctx.Data["Orgs"] = ctx.User.Orgs + ctx.Data["ContextUser"] = org + + ctx.Data["MyRepos"], err = models.GetRepositories(org.Id, true) + if err != nil { + ctx.Handle(500, "org.Dashboard(GetRepositories)", err) + return + } + + actions, err := models.GetFeeds(org.Id, 0, false) + if err != nil { + ctx.Handle(500, "org.Dashboard(GetFeeds)", err) + return + } + ctx.Data["Feeds"] = actions + + ctx.HTML(200, user.DASHBOARD) } func Setting(ctx *middleware.Context, param martini.Params) { diff --git a/routers/repo/http.go b/routers/repo/http.go index d2bff2997..981266d54 100644 --- a/routers/repo/http.go +++ b/routers/repo/http.go @@ -107,9 +107,9 @@ func Http(ctx *middleware.Context, params martini.Params) { } if !isPublicPull { - var tp = models.AU_WRITABLE + var tp = models.WRITABLE if isPull { - tp = models.AU_READABLE + tp = models.READABLE } has, err := models.HasAccess(authUsername, username+"/"+reponame, tp) @@ -117,8 +117,8 @@ func Http(ctx *middleware.Context, params martini.Params) { ctx.Handle(401, "no basic auth and digit auth", nil) return } else if !has { - if tp == models.AU_READABLE { - has, err = models.HasAccess(authUsername, username+"/"+reponame, models.AU_WRITABLE) + if tp == models.READABLE { + has, err = models.HasAccess(authUsername, username+"/"+reponame, models.WRITABLE) if err != nil || !has { ctx.Handle(401, "no basic auth and digit auth", nil) return diff --git a/routers/repo/setting.go b/routers/repo/setting.go index 6479cb304..3d48e79c3 100644 --- a/routers/repo/setting.go +++ b/routers/repo/setting.go @@ -175,7 +175,7 @@ func CollaborationPost(ctx *middleware.Context) { ctx.Redirect(ctx.Req.RequestURI) return } - has, err := models.HasAccess(name, repoLink, models.AU_WRITABLE) + has, err := models.HasAccess(name, repoLink, models.WRITABLE) if err != nil { ctx.Handle(500, "setting.CollaborationPost(HasAccess)", err) return @@ -196,7 +196,7 @@ func CollaborationPost(ctx *middleware.Context) { } if err = models.AddAccess(&models.Access{UserName: name, RepoName: repoLink, - Mode: models.AU_WRITABLE}); err != nil { + Mode: models.WRITABLE}); err != nil { ctx.Handle(500, "setting.CollaborationPost(AddAccess)", err) return } diff --git a/routers/user/home.go b/routers/user/home.go index 0f2cee256..86907b5a9 100644 --- a/routers/user/home.go +++ b/routers/user/home.go @@ -20,7 +20,7 @@ import ( const ( DASHBOARD base.TplName = "user/dashboard" PROFILE base.TplName = "user/profile" - ISSUES base.TplName = "user/issue" + ISSUES base.TplName = "user/issues" PULLS base.TplName = "user/pulls" STARS base.TplName = "user/stars" ) @@ -29,6 +29,13 @@ func Dashboard(ctx *middleware.Context) { ctx.Data["Title"] = "Dashboard" ctx.Data["PageIsUserDashboard"] = true + if err := ctx.User.GetOrganizations(); err != nil { + ctx.Handle(500, "home.Dashboard(GetOrganizations)", err) + return + } + ctx.Data["Orgs"] = ctx.User.Orgs + ctx.Data["ContextUser"] = ctx.User + var err error ctx.Data["MyRepos"], err = models.GetRepositories(ctx.User.Id, true) if err != nil { @@ -53,7 +60,7 @@ func Dashboard(ctx *middleware.Context) { for _, act := range actions { if act.IsPrivate { if has, _ := models.HasAccess(ctx.User.Name, act.RepoUserName+"/"+act.RepoName, - models.AU_READABLE); !has { + models.READABLE); !has { continue } } @@ -131,7 +138,7 @@ func Feeds(ctx *middleware.Context, form auth.FeedsForm) { for _, act := range actions { if act.IsPrivate { if has, _ := models.HasAccess(ctx.User.Name, act.RepoUserName+"/"+act.RepoName, - models.AU_READABLE); !has { + models.READABLE); !has { continue } } diff --git a/routers/user/user.go b/routers/user/user.go index 8144730e0..a50f126c0 100644 --- a/routers/user/user.go +++ b/routers/user/user.go @@ -226,7 +226,7 @@ func SignUpPost(ctx *middleware.Context, form auth.RegisterForm) { } var err error - if u, err = models.RegisterUser(u); err != nil { + if u, err = models.CreateUser(u); err != nil { switch err { case models.ErrUserAlreadyExist: ctx.Data["Err_UserName"] = true @@ -235,13 +235,14 @@ func SignUpPost(ctx *middleware.Context, form auth.RegisterForm) { ctx.Data["Err_Email"] = true ctx.RenderWithErr("E-mail address has been already used", SIGNUP, &form) case models.ErrUserNameIllegal: + ctx.Data["Err_UserName"] = true ctx.RenderWithErr(models.ErrRepoNameIllegal.Error(), SIGNUP, &form) default: - ctx.Handle(500, "user.SignUpPost(RegisterUser)", err) + ctx.Handle(500, "user.SignUpPost(CreateUser)", err) } return } - log.Trace("%s User created: %s", ctx.Req.RequestURI, form.UserName) + log.Trace("%s User created: %s", ctx.Req.RequestURI, u.Name) // Bind social account. if isOauth { diff --git a/templates/VERSION b/templates/VERSION index 8c2be60bb..b5cda695b 100644 --- a/templates/VERSION +++ b/templates/VERSION @@ -1 +1 @@ -0.4.5.0624 Alpha \ No newline at end of file +0.4.5.0625 Alpha \ No newline at end of file diff --git a/templates/org/dashboard.tmpl b/templates/org/dashboard.tmpl deleted file mode 100644 index f86de1f42..000000000 --- a/templates/org/dashboard.tmpl +++ /dev/null @@ -1,73 +0,0 @@ -{{template "base/head" .}} -{{template "base/navbar" .}} -
-
-
- - - -
- -

News Feed

-
-
-
- {{if .HasInfo}}
{{.InfoMsg}}
{{end}} -
-
    - {{range .Feeds}} -
  • - -
    {{TimeSince .Created}}
    {{ActionDesc . | str2html}}
    - -
  • - {{else}} -
  • Oh. Looks like there isn't any activity here yet. Get Busy!
  • - {{end}} -
-
-
-
-
Repositories -
- - -
-
- -
- -
-
-
-
-{{template "base/footer" .}} diff --git a/templates/org/new.tmpl b/templates/org/new.tmpl index baa9c9dfa..bb46db4ac 100644 --- a/templates/org/new.tmpl +++ b/templates/org/new.tmpl @@ -1,22 +1,14 @@ {{template "base/head" .}} {{template "base/navbar" .}}
-
+ {{.CsrfTokenHtml}}

Create New Organization

{{template "base/alert" .}} -
- -
-

{{.SignedUserName}}

- -
-
- -
+
- + Great organization names are short and memorable.
@@ -24,18 +16,10 @@
- + Organization's Email receives all notifications and confirmations.
- -
diff --git a/templates/user/dashboard.tmpl b/templates/user/dashboard.tmpl index 12018ad89..e1b43e159 100644 --- a/templates/user/dashboard.tmpl +++ b/templates/user/dashboard.tmpl @@ -4,29 +4,46 @@
-

News Feed

+
{{if .HasInfo}}
{{.InfoMsg}}
{{end}}
@@ -44,7 +61,7 @@
-
Your Repositories +
{{if not .PageIsOrgDashboard}}Your {{end}}Repositories
- + + {{if not .PageIsOrgDashboard}}
Collaborative Repositories
@@ -78,6 +96,7 @@
+ {{end}}
{{template "base/footer" .}} diff --git a/templates/user/issues.tmpl b/templates/user/issues.tmpl index d1c2bd994..c4ad64a4c 100644 --- a/templates/user/issues.tmpl +++ b/templates/user/issues.tmpl @@ -3,7 +3,7 @@
+
{{if .HasInfo}}
{{.InfoMsg}}
{{end}}
From 8e6c254c03dc19cac3ff6dad39f73b1509b46fcf Mon Sep 17 00:00:00 2001 From: Unknown Date: Wed, 25 Jun 2014 00:53:45 -0400 Subject: [PATCH 13/23] Mirror fix on create repo --- templates/repo/create.tmpl | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/templates/repo/create.tmpl b/templates/repo/create.tmpl index 0d1c42dee..fc0eb371b 100644 --- a/templates/repo/create.tmpl +++ b/templates/repo/create.tmpl @@ -10,21 +10,26 @@
+ +
From 8644c571dbcb964a338565c8042ff71957030e52 Mon Sep 17 00:00:00 2001 From: Unknown Date: Wed, 25 Jun 2014 05:27:17 -0400 Subject: [PATCH 18/23] Mirror bug fix on create repo action --- models/action.go | 3 ++- models/repo.go | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/models/action.go b/models/action.go index bbbe2134e..55557da2f 100644 --- a/models/action.go +++ b/models/action.go @@ -184,7 +184,8 @@ func CommitRepoAction(userId, repoUserId int64, userName, actEmail string, // NewRepoAction adds new action for creating repository. func NewRepoAction(u *User, repo *Repository) (err error) { if err = NotifyWatchers(&Action{ActUserId: u.Id, ActUserName: u.Name, ActEmail: u.Email, - OpType: OP_CREATE_REPO, RepoId: repo.Id, RepoName: repo.Name, IsPrivate: repo.IsPrivate}); err != nil { + OpType: OP_CREATE_REPO, RepoId: repo.Id, RepoUserName: repo.Owner.Name, RepoName: repo.Name, + IsPrivate: repo.IsPrivate}); err != nil { log.Error("action.NewRepoAction(notify watchers): %d/%s", u.Id, repo.Name) return err } diff --git a/models/repo.go b/models/repo.go index 9cf90a943..728f14a7d 100644 --- a/models/repo.go +++ b/models/repo.go @@ -475,6 +475,7 @@ func CreateRepository(u *User, name, desc, lang, license string, private, mirror repo := &Repository{ OwnerId: u.Id, + Owner: u, Name: name, LowerName: strings.ToLower(name), Description: desc, From 32b09681b2da96afe9a44790e7944c4ac51e696c Mon Sep 17 00:00:00 2001 From: Unknown Date: Wed, 25 Jun 2014 05:35:23 -0400 Subject: [PATCH 19/23] Migrate repository by organization --- models/repo.go | 8 +++---- modules/auth/repo.go | 1 + routers/repo/repo.go | 46 +++++++++++++++++++++++++++++-------- templates/repo/migrate.tmpl | 32 ++++++++++++++++++++++++-- 4 files changed, 72 insertions(+), 15 deletions(-) diff --git a/models/repo.go b/models/repo.go index 728f14a7d..840529b95 100644 --- a/models/repo.go +++ b/models/repo.go @@ -251,8 +251,8 @@ func MirrorUpdate() { } // MigrateRepository migrates a existing repository from other project hosting. -func MigrateRepository(user *User, name, desc string, private, mirror bool, url string) (*Repository, error) { - repo, err := CreateRepository(user, name, desc, "", "", private, mirror, false) +func MigrateRepository(u *User, name, desc string, private, mirror bool, url string) (*Repository, error) { + repo, err := CreateRepository(u, name, desc, "", "", private, mirror, false) if err != nil { return nil, err } @@ -261,11 +261,11 @@ func MigrateRepository(user *User, name, desc string, private, mirror bool, url tmpDir := filepath.Join(os.TempDir(), fmt.Sprintf("%d", time.Now().Nanosecond())) os.MkdirAll(tmpDir, os.ModePerm) - repoPath := RepoPath(user.Name, name) + repoPath := RepoPath(u.Name, name) repo.IsBare = false if mirror { - if err = MirrorRepository(repo.Id, user.Name, repo.Name, repoPath, url); err != nil { + if err = MirrorRepository(repo.Id, u.Name, repo.Name, repoPath, url); err != nil { return repo, err } repo.IsMirror = true diff --git a/modules/auth/repo.go b/modules/auth/repo.go index 999f33fe8..db13743de 100644 --- a/modules/auth/repo.go +++ b/modules/auth/repo.go @@ -48,6 +48,7 @@ type MigrateRepoForm struct { Url string `form:"url" binding:"Url"` AuthUserName string `form:"auth_username"` AuthPasswd string `form:"auth_password"` + Uid int64 `form:"uid" binding:"Required"` RepoName string `form:"repo" binding:"Required;AlphaDash;MaxSize(100)"` Mirror bool `form:"mirror"` Private bool `form:"private"` diff --git a/routers/repo/repo.go b/routers/repo/repo.go index d96456422..6cb6c0660 100644 --- a/routers/repo/repo.go +++ b/routers/repo/repo.go @@ -53,7 +53,7 @@ func CreatePost(ctx *middleware.Context, form auth.CreateRepoForm) { ctx.Data["Licenses"] = models.Licenses if err := ctx.User.GetOrganizations(); err != nil { - ctx.Handle(500, "home.Dashboard(GetOrganizations)", err) + ctx.Handle(500, "home.CreatePost(GetOrganizations)", err) return } ctx.Data["Orgs"] = ctx.User.Orgs @@ -70,9 +70,9 @@ func CreatePost(ctx *middleware.Context, form auth.CreateRepoForm) { u, err = models.GetUserById(form.Uid) if err != nil { if err == models.ErrUserNotExist { - ctx.Handle(404, "home.Dashboard(GetUserById)", err) + ctx.Handle(404, "home.CreatePost(GetUserById)", err) } else { - ctx.Handle(500, "home.Dashboard(GetUserById)", err) + ctx.Handle(500, "home.CreatePost(GetUserById)", err) } return } @@ -97,12 +97,19 @@ func CreatePost(ctx *middleware.Context, form auth.CreateRepoForm) { log.Error("repo.CreatePost(DeleteRepository): %v", errDelete) } } - ctx.Handle(500, "repo.CreatePost", err) + ctx.Handle(500, "repo.CreatePost(CreateRepository)", err) } func Migrate(ctx *middleware.Context) { ctx.Data["Title"] = "Migrate repository" ctx.Data["PageIsNewRepo"] = true + + if err := ctx.User.GetOrganizations(); err != nil { + ctx.Handle(500, "home.Migrate(GetOrganizations)", err) + return + } + ctx.Data["Orgs"] = ctx.User.Orgs + ctx.HTML(200, MIGRATE) } @@ -110,19 +117,40 @@ func MigratePost(ctx *middleware.Context, form auth.MigrateRepoForm) { ctx.Data["Title"] = "Migrate repository" ctx.Data["PageIsNewRepo"] = true + if err := ctx.User.GetOrganizations(); err != nil { + ctx.Handle(500, "home.MigratePost(GetOrganizations)", err) + return + } + ctx.Data["Orgs"] = ctx.User.Orgs + if ctx.HasError() { ctx.HTML(200, MIGRATE) return } + u := ctx.User + // Not equal means current user is an organization. + if u.Id != form.Uid { + var err error + u, err = models.GetUserById(form.Uid) + if err != nil { + if err == models.ErrUserNotExist { + ctx.Handle(404, "home.MigratePost(GetUserById)", err) + } else { + ctx.Handle(500, "home.MigratePost(GetUserById)", err) + } + return + } + } + authStr := strings.Replace(fmt.Sprintf("://%s:%s", form.AuthUserName, form.AuthPasswd), "@", "%40", -1) url := strings.Replace(form.Url, "://", authStr+"@", 1) - repo, err := models.MigrateRepository(ctx.User, form.RepoName, form.Description, form.Private, + repo, err := models.MigrateRepository(u, form.RepoName, form.Description, form.Private, form.Mirror, url) if err == nil { - log.Trace("%s Repository migrated: %s/%s", ctx.Req.RequestURI, ctx.User.LowerName, form.RepoName) - ctx.Redirect("/" + ctx.User.Name + "/" + form.RepoName) + log.Trace("%s Repository migrated: %s/%s", ctx.Req.RequestURI, u.LowerName, form.RepoName) + ctx.Redirect("/" + u.Name + "/" + form.RepoName) return } else if err == models.ErrRepoAlreadyExist { ctx.RenderWithErr("Repository name has already been used", MIGRATE, &form) @@ -133,7 +161,7 @@ func MigratePost(ctx *middleware.Context, form auth.MigrateRepoForm) { } if repo != nil { - if errDelete := models.DeleteRepository(ctx.User.Id, repo.Id, ctx.User.Name); errDelete != nil { + if errDelete := models.DeleteRepository(u.Id, repo.Id, u.Name); errDelete != nil { log.Error("repo.MigratePost(DeleteRepository): %v", errDelete) } } @@ -142,7 +170,7 @@ func MigratePost(ctx *middleware.Context, form auth.MigrateRepoForm) { ctx.RenderWithErr(err.Error(), MIGRATE, &form) return } - ctx.Handle(500, "repo.Migrate", err) + ctx.Handle(500, "repo.Migrate(MigrateRepository)", err) } func Single(ctx *middleware.Context, params martini.Params) { diff --git a/templates/repo/migrate.tmpl b/templates/repo/migrate.tmpl index 34a4077ee..fff25e6de 100644 --- a/templates/repo/migrate.tmpl +++ b/templates/repo/migrate.tmpl @@ -44,9 +44,37 @@
-

{{.SignedUserName}}

- +
+ + + +
+
From 19e910428951135b9a341554dad54a6546d2ad50 Mon Sep 17 00:00:00 2001 From: Unknown Date: Fri, 27 Jun 2014 03:37:01 -0400 Subject: [PATCH 20/23] Organization settings page --- cmd/web.go | 5 +- gogs.go | 2 +- models/org.go | 86 +++++++++++++ models/repo.go | 2 +- models/user.go | 114 ++++-------------- modules/auth/org.go | 30 ++++- modules/auth/repo.go | 2 +- modules/auth/user.go | 2 +- routers/org/org.go | 56 ++++++++- templates/VERSION | 2 +- templates/org/{setting.tmpl => settings.tmpl} | 56 +++------ 11 files changed, 217 insertions(+), 140 deletions(-) rename templates/org/{setting.tmpl => settings.tmpl} (72%) diff --git a/cmd/web.go b/cmd/web.go index 878fdeac7..729a1ba28 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -190,12 +190,13 @@ func runWeb(*cli.Context) { m.Group("/org", func(r martini.Router) { r.Get("/create", org.New) - r.Post("/create", bindIgnErr(auth.CreateOrganizationForm{}), org.NewPost) + r.Post("/create", bindIgnErr(auth.CreateOrgForm{}), org.NewPost) r.Get("/:org", org.Organization) r.Get("/:org/dashboard", org.Dashboard) r.Get("/:org/members", org.Members) r.Get("/:org/teams", org.Teams) - r.Get("/:org/setting", org.Setting) + r.Get("/:org/settings", org.Settings) + r.Post("/:org/settings", bindIgnErr(auth.OrgSettingForm{}), org.SettingsPost) }, reqSignIn) m.Group("/:username/:reponame", func(r martini.Router) { diff --git a/gogs.go b/gogs.go index 5c2c6ed94..d56760ab2 100644 --- a/gogs.go +++ b/gogs.go @@ -17,7 +17,7 @@ import ( "github.com/gogits/gogs/modules/setting" ) -const APP_VER = "0.4.5.0625 Alpha" +const APP_VER = "0.4.5.0627 Alpha" func init() { runtime.GOMAXPROCS(runtime.NumCPU()) diff --git a/models/org.go b/models/org.go index 227151ab0..553a46aa0 100644 --- a/models/org.go +++ b/models/org.go @@ -4,6 +4,88 @@ package models +import ( + "strings" + + "github.com/gogits/gogs/modules/base" +) + +// CreateOrganization creates record of a new organization. +func CreateOrganization(org, owner *User) (*User, error) { + if !IsLegalName(org.Name) { + return nil, ErrUserNameIllegal + } + + isExist, err := IsUserExist(org.Name) + if err != nil { + return nil, err + } else if isExist { + return nil, ErrUserAlreadyExist + } + + isExist, err = IsEmailUsed(org.Email) + if err != nil { + return nil, err + } else if isExist { + return nil, ErrEmailAlreadyUsed + } + + org.LowerName = strings.ToLower(org.Name) + org.FullName = org.Name + org.Avatar = base.EncodeMd5(org.Email) + org.AvatarEmail = org.Email + // No password for organization. + org.NumTeams = 1 + org.NumMembers = 1 + + sess := x.NewSession() + defer sess.Close() + if err = sess.Begin(); err != nil { + return nil, err + } + + if _, err = sess.Insert(org); err != nil { + sess.Rollback() + return nil, err + } + + // Create default owner team. + t := &Team{ + OrgId: org.Id, + Name: OWNER_TEAM, + Authorize: ORG_ADMIN, + NumMembers: 1, + } + if _, err = sess.Insert(t); err != nil { + sess.Rollback() + return nil, err + } + + // Add initial creator to organization and owner team. + ou := &OrgUser{ + Uid: owner.Id, + OrgId: org.Id, + IsOwner: true, + NumTeam: 1, + } + if _, err = sess.Insert(ou); err != nil { + sess.Rollback() + return nil, err + } + + tu := &TeamUser{ + Uid: owner.Id, + OrgId: org.Id, + TeamId: t.Id, + } + if _, err = sess.Insert(tu); err != nil { + sess.Rollback() + return nil, err + } + + return org, sess.Commit() +} + type AuthorizeType int const ( @@ -72,6 +154,10 @@ func GetOrgUsersByOrgId(orgId int64) ([]*OrgUser, error) { return ous, err } +func GetOrganizationCount(u *User) (int64, error) { + return x.Where("uid=?", u.Id).Count(new(OrgUser)) +} + // ___________ ____ ___ // \__ ___/___ _____ _____ | | \______ ___________ // | |_/ __ \\__ \ / \| | / ___// __ \_ __ \ diff --git a/models/repo.go b/models/repo.go index 840529b95..85f2a913d 100644 --- a/models/repo.go +++ b/models/repo.go @@ -240,7 +240,7 @@ func MirrorUpdate() { "git", "remote", "update"); err != nil { return errors.New("git remote update: " + stderr) } else if err = git.UnpackRefs(repoPath); err != nil { - return err + return errors.New("UnpackRefs: " + err.Error()) } m.NextUpdate = time.Now().Add(time.Duration(m.Interval) * time.Hour) diff --git a/models/user.go b/models/user.go index f67911ca6..8ffad2663 100644 --- a/models/user.go +++ b/models/user.go @@ -30,6 +30,7 @@ const ( var ( ErrUserOwnRepos = errors.New("User still have ownership of repositories") + ErrUserHasOrgs = errors.New("User still have membership of organization") ErrUserAlreadyExist = errors.New("User already exist") ErrUserNotExist = errors.New("User does not exist") ErrUserNotKeyOwner = errors.New("User does not the owner of public key") @@ -69,8 +70,9 @@ type User struct { Updated time.Time `xorm:"updated"` // For organization. - NumTeams int - NumMembers int + Description string + NumTeams int + NumMembers int } // HomeLink returns the user home page link. @@ -211,81 +213,6 @@ func CreateUser(u *User) (*User, error) { return u, err } -// CreateOrganization creates record of a new organization. -func CreateOrganization(org, owner *User) (*User, error) { - if !IsLegalName(org.Name) { - return nil, ErrUserNameIllegal - } - - isExist, err := IsUserExist(org.Name) - if err != nil { - return nil, err - } else if isExist { - return nil, ErrUserAlreadyExist - } - - isExist, err = IsEmailUsed(org.Email) - if err != nil { - return nil, err - } else if isExist { - return nil, ErrEmailAlreadyUsed - } - - org.LowerName = strings.ToLower(org.Name) - org.Avatar = base.EncodeMd5(org.Email) - org.AvatarEmail = org.Email - // No password for organization. - org.NumTeams = 1 - org.NumMembers = 1 - - sess := x.NewSession() - defer sess.Close() - if err = sess.Begin(); err != nil { - return nil, err - } - - if _, err = sess.Insert(org); err != nil { - sess.Rollback() - return nil, err - } - - // Create default owner team. - t := &Team{ - OrgId: org.Id, - Name: OWNER_TEAM, - Authorize: ORG_ADMIN, - NumMembers: 1, - } - if _, err = sess.Insert(t); err != nil { - sess.Rollback() - return nil, err - } - - // Add initial creator to organization and owner team. - ou := &OrgUser{ - Uid: owner.Id, - OrgId: org.Id, - IsOwner: true, - NumTeam: 1, - } - if _, err = sess.Insert(ou); err != nil { - sess.Rollback() - return nil, err - } - - tu := &TeamUser{ - Uid: owner.Id, - OrgId: org.Id, - TeamId: t.Id, - } - if _, err = sess.Insert(tu); err != nil { - sess.Rollback() - return nil, err - } - - return org, sess.Commit() -} - // GetUsers returns given number of user objects with offset. func GetUsers(num, offset int) ([]User, error) { users := make([]User, 0, num) @@ -392,51 +319,62 @@ func UpdateUser(u *User) (err error) { if len(u.Website) > 255 { u.Website = u.Website[:255] } + if len(u.Description) > 255 { + u.Description = u.Description[:255] + } _, err = x.Id(u.Id).AllCols().Update(u) return err } // DeleteUser completely deletes everything of the user. -func DeleteUser(user *User) error { +func DeleteUser(u *User) error { // Check ownership of repository. - count, err := GetRepositoryCount(user) + count, err := GetRepositoryCount(u) if err != nil { - return errors.New("modesl.GetRepositories: " + err.Error()) + return errors.New("modesl.GetRepositories(GetRepositoryCount): " + err.Error()) } else if count > 0 { return ErrUserOwnRepos } + // Check membership of organization. + count, err = GetOrganizationCount(u) + if err != nil { + return errors.New("modesl.GetRepositories(GetOrganizationCount): " + err.Error()) + } else if count > 0 { + return ErrUserHasOrgs + } + // TODO: check issues, other repos' commits // Delete all followers. - if _, err = x.Delete(&Follow{FollowId: user.Id}); err != nil { + if _, err = x.Delete(&Follow{FollowId: u.Id}); err != nil { return err } // Delete oauth2. - if _, err = x.Delete(&Oauth2{Uid: user.Id}); err != nil { + if _, err = x.Delete(&Oauth2{Uid: u.Id}); err != nil { return err } // Delete all feeds. - if _, err = x.Delete(&Action{UserId: user.Id}); err != nil { + if _, err = x.Delete(&Action{UserId: u.Id}); err != nil { return err } // Delete all watches. - if _, err = x.Delete(&Watch{UserId: user.Id}); err != nil { + if _, err = x.Delete(&Watch{UserId: u.Id}); err != nil { return err } // Delete all accesses. - if _, err = x.Delete(&Access{UserName: user.LowerName}); err != nil { + if _, err = x.Delete(&Access{UserName: u.LowerName}); err != nil { return err } // Delete all SSH keys. keys := make([]*PublicKey, 0, 10) - if err = x.Find(&keys, &PublicKey{OwnerId: user.Id}); err != nil { + if err = x.Find(&keys, &PublicKey{OwnerId: u.Id}); err != nil { return err } for _, key := range keys { @@ -446,11 +384,11 @@ func DeleteUser(user *User) error { } // Delete user directory. - if err = os.RemoveAll(UserPath(user.Name)); err != nil { + if err = os.RemoveAll(UserPath(u.Name)); err != nil { return err } - _, err = x.Delete(user) + _, err = x.Delete(u) return err } diff --git a/modules/auth/org.go b/modules/auth/org.go index a60fbb851..f87d10a70 100644 --- a/modules/auth/org.go +++ b/modules/auth/org.go @@ -14,12 +14,12 @@ import ( "github.com/gogits/gogs/modules/middleware/binding" ) -type CreateOrganizationForm struct { +type CreateOrgForm struct { OrgName string `form:"orgname" binding:"Required;AlphaDashDot;MaxSize(30)"` Email string `form:"email" binding:"Required;Email;MaxSize(50)"` } -func (f *CreateOrganizationForm) Name(field string) string { +func (f *CreateOrgForm) Name(field string) string { names := map[string]string{ "OrgName": "Organization name", "Email": "E-mail address", @@ -27,7 +27,31 @@ func (f *CreateOrganizationForm) Name(field string) string { return names[field] } -func (f *CreateOrganizationForm) Validate(errs *binding.Errors, req *http.Request, ctx martini.Context) { +func (f *CreateOrgForm) Validate(errs *binding.Errors, req *http.Request, ctx martini.Context) { data := ctx.Get(reflect.TypeOf(base.TmplData{})).Interface().(base.TmplData) validate(errs, data, f) } + +type OrgSettingForm struct { + DisplayName string `form:"display_name" binding:"Required;MaxSize(100)"` + Email string `form:"email" binding:"Required;Email;MaxSize(50)"` + Description string `form:"desc" binding:"MaxSize(255)"` + Website string `form:"site" binding:"Url;MaxSize(100)"` + Location string `form:"location" binding:"MaxSize(50)"` +} + +func (f *OrgSettingForm) Name(field string) string { + names := map[string]string{ + "DisplayName": "Display name", + "Email": "E-mail address", + "Description": "Description", + "Website": "Website address", + "Location": "Location", + } + return names[field] +} + +func (f *OrgSettingForm) Validate(errors *binding.Errors, req *http.Request, context martini.Context) { + data := context.Get(reflect.TypeOf(base.TmplData{})).Interface().(base.TmplData) + validate(errors, data, f) +} diff --git a/modules/auth/repo.go b/modules/auth/repo.go index db13743de..d3d215322 100644 --- a/modules/auth/repo.go +++ b/modules/auth/repo.go @@ -71,7 +71,7 @@ func (f *MigrateRepoForm) Validate(errors *binding.Errors, req *http.Request, co type RepoSettingForm struct { RepoName string `form:"name" binding:"Required;AlphaDash;MaxSize(100)"` - Description string `form:"desc" binding:"MaxSize(100)"` + Description string `form:"desc" binding:"MaxSize(255)"` Website string `form:"site" binding:"Url;MaxSize(100)"` Branch string `form:"branch"` Interval int `form:"interval"` diff --git a/modules/auth/user.go b/modules/auth/user.go index 20f993362..4a781acfa 100644 --- a/modules/auth/user.go +++ b/modules/auth/user.go @@ -93,7 +93,7 @@ func (f *UpdateProfileForm) Name(field string) string { names := map[string]string{ "UserName": "Username", "Email": "E-mail address", - "Website": "Website", + "Website": "Website address", "Location": "Location", "Avatar": "Gravatar Email", } diff --git a/routers/org/org.go b/routers/org/org.go index 0595a81b3..4f57b9a96 100644 --- a/routers/org/org.go +++ b/routers/org/org.go @@ -16,7 +16,8 @@ import ( ) const ( - NEW base.TplName = "org/new" + NEW base.TplName = "org/new" + SETTINGS base.TplName = "org/settings" ) func Organization(ctx *middleware.Context, params martini.Params) { @@ -39,7 +40,7 @@ func New(ctx *middleware.Context) { ctx.HTML(200, NEW) } -func NewPost(ctx *middleware.Context, form auth.CreateOrganizationForm) { +func NewPost(ctx *middleware.Context, form auth.CreateOrgForm) { ctx.Data["Title"] = "Create An Organization" if ctx.HasError() { @@ -114,7 +115,52 @@ func Dashboard(ctx *middleware.Context, params martini.Params) { ctx.HTML(200, user.DASHBOARD) } -func Setting(ctx *middleware.Context, param martini.Params) { - ctx.Data["Title"] = "Setting" - ctx.HTML(200, "org/setting") +func Settings(ctx *middleware.Context, params martini.Params) { + ctx.Data["Title"] = "Settings" + + org, err := models.GetUserByName(params["org"]) + if err != nil { + if err == models.ErrUserNotExist { + ctx.Handle(404, "org.Settings(GetUserByName)", err) + } else { + ctx.Handle(500, "org.Settings(GetUserByName)", err) + } + return + } + ctx.Data["Org"] = org + + ctx.HTML(200, SETTINGS) +} + +func SettingsPost(ctx *middleware.Context, params martini.Params, form auth.OrgSettingForm) { + ctx.Data["Title"] = "Settings" + + org, err := models.GetUserByName(params["org"]) + if err != nil { + if err == models.ErrUserNotExist { + ctx.Handle(404, "org.SettingsPost(GetUserByName)", err) + } else { + ctx.Handle(500, "org.SettingsPost(GetUserByName)", err) + } + return + } + ctx.Data["Org"] = org + + if ctx.HasError() { + ctx.HTML(200, SETTINGS) + return + } + + org.FullName = form.DisplayName + org.Email = form.Email + org.Description = form.Description + org.Website = form.Website + org.Location = form.Location + if err = models.UpdateUser(org); err != nil { + ctx.Handle(500, "org.SettingsPost(UpdateUser)", err) + return + } + log.Trace("%s Organization setting updated: %s", ctx.Req.RequestURI, org.LowerName) + ctx.Flash.Success("Organization profile has been successfully updated.") + ctx.Redirect("/org/" + org.Name + "/settings") } diff --git a/templates/VERSION b/templates/VERSION index b5cda695b..be0ebee0f 100644 --- a/templates/VERSION +++ b/templates/VERSION @@ -1 +1 @@ -0.4.5.0625 Alpha \ No newline at end of file +0.4.5.0627 Alpha \ No newline at end of file diff --git a/templates/org/setting.tmpl b/templates/org/settings.tmpl similarity index 72% rename from templates/org/setting.tmpl rename to templates/org/settings.tmpl index 1be9707a1..e19c027d4 100644 --- a/templates/org/setting.tmpl +++ b/templates/org/settings.tmpl @@ -4,32 +4,20 @@
-
+
    @@ -40,52 +28,46 @@ {{template "base/alert" .}}
    - Repository Options + Organization Options
    - + {{.CsrfTokenHtml}} -
    - - +
    +
    - +
    -
    +
    -
    - +
    -
    +
    -
    - +
    -
    +
    -
    - +
    -
    +
    -
    - +
    From b5ba2bd268b144ae0c878fe17257d8685d92f9cc Mon Sep 17 00:00:00 2001 From: fuxiaohei Date: Fri, 27 Jun 2014 21:33:49 +0800 Subject: [PATCH 21/23] add organization team-create page --- cmd/web.go | 3 ++ public/css/gogs.css | 2 +- routers/org/org.go | 4 -- routers/org/teams.go | 16 ++++++++ templates/org/new_team.tmpl | 74 +++++++++++++++++++++++++++++++++++++ templates/org/teams.tmpl | 6 +++ 6 files changed, 100 insertions(+), 5 deletions(-) create mode 100644 routers/org/teams.go create mode 100644 templates/org/new_team.tmpl diff --git a/cmd/web.go b/cmd/web.go index 729a1ba28..bf84d5872 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -194,7 +194,10 @@ func runWeb(*cli.Context) { r.Get("/:org", org.Organization) r.Get("/:org/dashboard", org.Dashboard) r.Get("/:org/members", org.Members) + // organization teams + r.Get("/:org/teams/new",org.NewTeam) r.Get("/:org/teams", org.Teams) + r.Get("/:org/settings", org.Settings) r.Post("/:org/settings", bindIgnErr(auth.OrgSettingForm{}), org.SettingsPost) }, reqSignIn) diff --git a/public/css/gogs.css b/public/css/gogs.css index 960176f58..eb95a1d08 100755 --- a/public/css/gogs.css +++ b/public/css/gogs.css @@ -375,7 +375,7 @@ html, body { /* gogits repo create */ -#repo-create, #org-create { +#repo-create, #org-create, #org-teams-create { width: 800px; } diff --git a/routers/org/org.go b/routers/org/org.go index 4f57b9a96..c036a8e5d 100644 --- a/routers/org/org.go +++ b/routers/org/org.go @@ -30,10 +30,6 @@ func Members(ctx *middleware.Context, params martini.Params) { ctx.HTML(200, "org/members") } -func Teams(ctx *middleware.Context, params martini.Params) { - ctx.Data["Title"] = "Organization " + params["org"] + " Teams" - ctx.HTML(200, "org/teams") -} func New(ctx *middleware.Context) { ctx.Data["Title"] = "Create An Organization" diff --git a/routers/org/teams.go b/routers/org/teams.go new file mode 100644 index 000000000..9585cb272 --- /dev/null +++ b/routers/org/teams.go @@ -0,0 +1,16 @@ +package org + +import ( + "github.com/go-martini/martini" + "github.com/gogits/gogs/modules/middleware" +) + +func Teams(ctx *middleware.Context, params martini.Params) { + ctx.Data["Title"] = "Organization "+params["org"]+" Teams" + ctx.HTML(200, "org/teams") +} + +func NewTeam(ctx *middleware.Context, params martini.Params) { + ctx.Data["Title"] = "Organization "+params["org"]+" New Team" + ctx.HTML(200, "org/new_team") +} diff --git a/templates/org/new_team.tmpl b/templates/org/new_team.tmpl new file mode 100644 index 000000000..752f37d2e --- /dev/null +++ b/templates/org/new_team.tmpl @@ -0,0 +1,74 @@ +{{template "base/head" .}} +{{template "base/navbar" .}} +
    +
    +
    + + +
    +

    Organization Name

    +
    +
    +
    +
    +
    +
    + +

    Create new team

    +
    + +
    + + You'll use this name to mention this team in conversations. +
    +
    +
    + +
    + +
    +
    +
    + +
    +
    + +

    This team will be able to view and clone its repositories.

    +
    +
    + +

    This team will be able to read its repositories, as well as push to them.

    +
    +
    + +

    This team will be able to push/pull to its repositories, as well as add other collaborators to them.

    +
    +
    +
    +
    +
    + +
    + +
    +
    + +
    +
    +{{template "base/footer" .}} diff --git a/templates/org/teams.tmpl b/templates/org/teams.tmpl index a8218812c..90aab9440 100644 --- a/templates/org/teams.tmpl +++ b/templates/org/teams.tmpl @@ -21,6 +21,12 @@
    +
    +
    + +
    +
    +

    Team Name

    From 1d55ecd29ce261cd3adf78649a44aaa30e4fd468 Mon Sep 17 00:00:00 2001 From: fuxiaohei Date: Fri, 27 Jun 2014 22:04:04 +0800 Subject: [PATCH 22/23] add organization team-create page --- cmd/web.go | 3 +- public/css/gogs.css | 2 +- routers/org/teams.go | 5 +++ templates/org/edit_team.tmpl | 75 ++++++++++++++++++++++++++++++++++++ 4 files changed, 83 insertions(+), 2 deletions(-) create mode 100644 templates/org/edit_team.tmpl diff --git a/cmd/web.go b/cmd/web.go index bf84d5872..1668fae24 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -195,7 +195,8 @@ func runWeb(*cli.Context) { r.Get("/:org/dashboard", org.Dashboard) r.Get("/:org/members", org.Members) // organization teams - r.Get("/:org/teams/new",org.NewTeam) + r.Get("/:org/teams/:team/edit", org.EditTeam) + r.Get("/:org/teams/new", org.NewTeam) r.Get("/:org/teams", org.Teams) r.Get("/:org/settings", org.Settings) diff --git a/public/css/gogs.css b/public/css/gogs.css index eb95a1d08..98cb5ee18 100755 --- a/public/css/gogs.css +++ b/public/css/gogs.css @@ -375,7 +375,7 @@ html, body { /* gogits repo create */ -#repo-create, #org-create, #org-teams-create { +#repo-create, #org-create, #org-teams-create, #org-teams-edit { width: 800px; } diff --git a/routers/org/teams.go b/routers/org/teams.go index 9585cb272..9ca5185a9 100644 --- a/routers/org/teams.go +++ b/routers/org/teams.go @@ -14,3 +14,8 @@ func NewTeam(ctx *middleware.Context, params martini.Params) { ctx.Data["Title"] = "Organization "+params["org"]+" New Team" ctx.HTML(200, "org/new_team") } + +func EditTeam(ctx *middleware.Context, params martini.Params){ + ctx.Data["Title"] = "Organization "+params["org"]+" Edit Team" + ctx.HTML(200,"org/edit_team") +} diff --git a/templates/org/edit_team.tmpl b/templates/org/edit_team.tmpl new file mode 100644 index 000000000..4292575c8 --- /dev/null +++ b/templates/org/edit_team.tmpl @@ -0,0 +1,75 @@ +{{template "base/head" .}} +{{template "base/navbar" .}} +
    +
    +
    + + +
    +

    Organization Name

    +
    +
    +
    +
    +
    +
    +
    +

    Edit team

    +
    + +
    + + You'll use this name to mention this team in conversations. +
    +
    +
    + +
    + +
    +
    +
    + +
    +
    + +

    This team will be able to view and clone its repositories.

    +
    +
    + +

    This team will be able to read its repositories, as well as push to them.

    +
    +
    + +

    This team will be able to push/pull to its repositories, as well as add other collaborators to them.

    +
    +
    +
    +
    +
    + +
    + + +
    +
    +
    +
    +
    +{{template "base/footer" .}} From ee9b7f322ff4c4c14952c2f83fb03e90fa583cad Mon Sep 17 00:00:00 2001 From: Unknown Date: Fri, 27 Jun 2014 23:14:33 -0400 Subject: [PATCH 23/23] Clean code --- routers/user/setting.go | 2 +- routers/user/user.go | 2 +- templates/org/settings.tmpl | 9 +++------ 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/routers/user/setting.go b/routers/user/setting.go index 9075ee0b4..8e4b0840c 100644 --- a/routers/user/setting.go +++ b/routers/user/setting.go @@ -68,7 +68,7 @@ func SettingPost(ctx *middleware.Context, form auth.UpdateProfileForm) { ctx.User.Avatar = base.EncodeMd5(form.Avatar) ctx.User.AvatarEmail = form.Avatar if err := models.UpdateUser(ctx.User); err != nil { - ctx.Handle(500, "setting.Setting", err) + ctx.Handle(500, "setting.Setting(UpdateUser)", err) return } log.Trace("%s User setting updated: %s", ctx.Req.RequestURI, ctx.User.LowerName) diff --git a/routers/user/user.go b/routers/user/user.go index a50f126c0..a402744b8 100644 --- a/routers/user/user.go +++ b/routers/user/user.go @@ -296,7 +296,7 @@ func DeletePost(ctx *middleware.Context) { case models.ErrUserOwnRepos: ctx.Flash.Error("Your account still have ownership of repository, you have to delete or transfer them first.") default: - ctx.Handle(500, "user.Delete", err) + ctx.Handle(500, "user.Delete(DeleteUser)", err) return } } else { diff --git a/templates/org/settings.tmpl b/templates/org/settings.tmpl index e19c027d4..fd0d6a1c1 100644 --- a/templates/org/settings.tmpl +++ b/templates/org/settings.tmpl @@ -98,11 +98,9 @@