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"
)
/* 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) {
me := ctxt.CurrentUser()
prefs, err := me.Prefs()
@@ -103,7 +111,7 @@ func ShowCommunity(ctxt ui.AmContext) (string, any, error) {
ctxt.VarMap().Set("addrLast", b.String())
if ci.Country != nil && *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()
if err == nil && tag != nil {
+9
View File
@@ -27,6 +27,15 @@ domains:
linkSequence: 5000
link: "/TODO/comm/[CID]/admin"
title: "Administration"
- id: "SysAdmin"
index: 2
default: false
locked: true
requirePermission: "Global.SysAdminAccess"
requireRole: ""
linkSequence: 10000
link: "/sysadmin"
title: "System Administration"
- id: "Conference"
index: 3
default: true
-1
View File
@@ -32,7 +32,6 @@ func SysAdminMenu(ctxt ui.AmContext) (string, any, error) {
ctxt.SetRC(http.StatusForbidden)
return ui.ErrorPage(ctxt, errors.New("you are not authorized access to this page"))
}
ctxt.SetLeftMenu("top")
menu := ui.AmMenu("sysadmin")
ctxt.VarMap().Set("menu", menu)
ctxt.VarMap().Set("amsterdam_pageTitle", menu.Title)
+21 -9
View File
@@ -12,6 +12,7 @@ package ui
import (
"bytes"
"fmt"
"mime/multipart"
"net/http"
"strconv"
@@ -279,15 +280,20 @@ func (c *amContext) SetCommunityContext(param string) error {
if err != nil {
return err
}
mbr, lock, level, err := comm.Membership(c.CurrentUser())
if err != nil {
return err
}
c.community = comm
c.isMember = mbr
c.isMemberLocked = lock
if level > c.effectiveLevel {
c.effectiveLevel = level
if c.community == nil || c.community.Id != comm.Id {
mbr, lock, level, err := comm.Membership(c.CurrentUser())
if err != nil {
return err
}
c.community = comm
c.isMember = mbr
c.isMemberLocked = lock
if level > c.effectiveLevel {
c.effectiveLevel = level
}
if mbr {
c.session.Values["lastCommunity"] = comm.Id
}
}
return nil
}
@@ -421,6 +427,12 @@ func AmCreateContext(ctxt echo.Context) (AmContext, error) {
rc.user = nil
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
}
-3
View File
@@ -26,9 +26,6 @@ menudefs:
disabled: true
- text: "About Amsterdam"
link: "/about"
- text: "System Administration"
link: "/sysadmin"
permission: "Global.SysAdminAccess"
- id: "sysadmin"
title: "System Administration"
permSet: "user"
+1 -1
View File
@@ -416,7 +416,7 @@ func ShowProfile(ctxt ui.AmContext) (string, any, error) {
ctxt.VarMap().Set("addrLast", b.String())
if ci.Country != nil {
country := countries.ByName(*ci.Country)
ctxt.VarMap().Set("country", country.String())
ctxt.VarMap().Set("country", country.Emoji()+" "+country.String())
}
if !pvtPhone && ci.Phone != nil {
ctxt.VarMap().Set("phone", *ci.Phone)