moved System Administration link back into Administration community, fixed up some bugs around that

This commit is contained in:
2025-10-17 13:16:14 -06:00
parent 137bf35a8b
commit be5b3a426d
6 changed files with 40 additions and 15 deletions
+9 -1
View File
@@ -19,6 +19,14 @@ import (
"golang.org/x/text/language/display" "golang.org/x/text/language/display"
) )
/* ShowCommunity renders the community profile display.
* Parameters:
* ctxt - The AmContext for the request.
* Returns:
* Command string dictating what to be rendered.
* Data as a parameter for the command string.
* Standard Go error status.
*/
func ShowCommunity(ctxt ui.AmContext) (string, any, error) { func ShowCommunity(ctxt ui.AmContext) (string, any, error) {
me := ctxt.CurrentUser() me := ctxt.CurrentUser()
prefs, err := me.Prefs() prefs, err := me.Prefs()
@@ -103,7 +111,7 @@ func ShowCommunity(ctxt ui.AmContext) (string, any, error) {
ctxt.VarMap().Set("addrLast", b.String()) ctxt.VarMap().Set("addrLast", b.String())
if ci.Country != nil && *ci.Country != "" { if ci.Country != nil && *ci.Country != "" {
country := countries.ByName(*ci.Country) country := countries.ByName(*ci.Country)
ctxt.VarMap().Set("country", country.String()) ctxt.VarMap().Set("country", country.Emoji()+" "+country.String())
} }
tag, err := comm.LanguageTag() tag, err := comm.LanguageTag()
if err == nil && tag != nil { if err == nil && tag != nil {
+9
View File
@@ -27,6 +27,15 @@ domains:
linkSequence: 5000 linkSequence: 5000
link: "/TODO/comm/[CID]/admin" link: "/TODO/comm/[CID]/admin"
title: "Administration" title: "Administration"
- id: "SysAdmin"
index: 2
default: false
locked: true
requirePermission: "Global.SysAdminAccess"
requireRole: ""
linkSequence: 10000
link: "/sysadmin"
title: "System Administration"
- id: "Conference" - id: "Conference"
index: 3 index: 3
default: true default: true
-1
View File
@@ -32,7 +32,6 @@ func SysAdminMenu(ctxt ui.AmContext) (string, any, error) {
ctxt.SetRC(http.StatusForbidden) ctxt.SetRC(http.StatusForbidden)
return ui.ErrorPage(ctxt, errors.New("you are not authorized access to this page")) return ui.ErrorPage(ctxt, errors.New("you are not authorized access to this page"))
} }
ctxt.SetLeftMenu("top")
menu := ui.AmMenu("sysadmin") menu := ui.AmMenu("sysadmin")
ctxt.VarMap().Set("menu", menu) ctxt.VarMap().Set("menu", menu)
ctxt.VarMap().Set("amsterdam_pageTitle", menu.Title) ctxt.VarMap().Set("amsterdam_pageTitle", menu.Title)
+12
View File
@@ -12,6 +12,7 @@ package ui
import ( import (
"bytes" "bytes"
"fmt"
"mime/multipart" "mime/multipart"
"net/http" "net/http"
"strconv" "strconv"
@@ -279,6 +280,7 @@ func (c *amContext) SetCommunityContext(param string) error {
if err != nil { if err != nil {
return err return err
} }
if c.community == nil || c.community.Id != comm.Id {
mbr, lock, level, err := comm.Membership(c.CurrentUser()) mbr, lock, level, err := comm.Membership(c.CurrentUser())
if err != nil { if err != nil {
return err return err
@@ -289,6 +291,10 @@ func (c *amContext) SetCommunityContext(param string) error {
if level > c.effectiveLevel { if level > c.effectiveLevel {
c.effectiveLevel = level c.effectiveLevel = level
} }
if mbr {
c.session.Values["lastCommunity"] = comm.Id
}
}
return nil return nil
} }
@@ -421,6 +427,12 @@ func AmCreateContext(ctxt echo.Context) (AmContext, error) {
rc.user = nil rc.user = nil
rc.effectiveLevel = database.AmRole("NotInList").Level() rc.effectiveLevel = database.AmRole("NotInList").Level()
} }
if !rc.user.IsAnon {
cp, ok := sess.Values["lastCommunity"]
if ok {
rc.SetCommunityContext(fmt.Sprintf("%d", cp))
}
}
return rc, err return rc, err
} }
-3
View File
@@ -26,9 +26,6 @@ menudefs:
disabled: true disabled: true
- text: "About Amsterdam" - text: "About Amsterdam"
link: "/about" link: "/about"
- text: "System Administration"
link: "/sysadmin"
permission: "Global.SysAdminAccess"
- id: "sysadmin" - id: "sysadmin"
title: "System Administration" title: "System Administration"
permSet: "user" permSet: "user"
+1 -1
View File
@@ -416,7 +416,7 @@ func ShowProfile(ctxt ui.AmContext) (string, any, error) {
ctxt.VarMap().Set("addrLast", b.String()) ctxt.VarMap().Set("addrLast", b.String())
if ci.Country != nil { if ci.Country != nil {
country := countries.ByName(*ci.Country) country := countries.ByName(*ci.Country)
ctxt.VarMap().Set("country", country.String()) ctxt.VarMap().Set("country", country.Emoji()+" "+country.String())
} }
if !pvtPhone && ci.Phone != nil { if !pvtPhone && ci.Phone != nil {
ctxt.VarMap().Set("phone", *ci.Phone) ctxt.VarMap().Set("phone", *ci.Phone)