global properties form in place
This commit is contained in:
@@ -13,6 +13,7 @@ package ui
|
||||
import (
|
||||
"embed"
|
||||
"fmt"
|
||||
"math"
|
||||
"net/mail"
|
||||
"strconv"
|
||||
"strings"
|
||||
@@ -66,6 +67,11 @@ type VRange struct {
|
||||
High int
|
||||
}
|
||||
|
||||
// IsEmpty tells us if a value range is empty.
|
||||
func (vr *VRange) IsEmpty() bool {
|
||||
return vr.Low == -1 && vr.High == -1
|
||||
}
|
||||
|
||||
//go:embed dialogs/*
|
||||
var dialogs embed.FS
|
||||
|
||||
@@ -92,6 +98,16 @@ func AmLoadDialog(name string) (*Dialog, error) {
|
||||
if fld.Type == "date" && fld.Param == "" {
|
||||
d.Fields[i].Param = "year:-100"
|
||||
}
|
||||
if fld.Type == "integer" && fld.Size == 0 {
|
||||
vr := fld.ValueRange()
|
||||
if !vr.IsEmpty() {
|
||||
// compute the number of digits in each end of the range and take the maximum as the size
|
||||
dlow := int(math.Floor(math.Log10(float64(vr.Low)))) + 1
|
||||
dhigh := int(math.Floor(math.Log10(float64(vr.High)))) + 1
|
||||
d.Fields[i].Size = max(dlow, dhigh)
|
||||
d.Fields[i].MaxLength = d.Fields[i].Size
|
||||
}
|
||||
}
|
||||
if fld.Type == "dropdown" && len(fld.Choices) == 0 {
|
||||
return nil, fmt.Errorf("dropdown field %s in dialog %s has no choices", fld.Name, name)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
#
|
||||
# Amsterdam Web Communities System
|
||||
# Copyright (c) 2025-2026 Erbosoft Metaverse Design Solutions, All Rights Reserved
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
#
|
||||
name: "global.properties"
|
||||
formName: "globpropform"
|
||||
menuSelector: "nochange"
|
||||
title: "Edit Global Properties"
|
||||
action: "/sysadmin/globals"
|
||||
fields:
|
||||
- type: "header"
|
||||
name: "header1"
|
||||
caption: "System Properties"
|
||||
- type: "integer"
|
||||
name: "search_items"
|
||||
caption: "Number of search items to display per page"
|
||||
param: "5-100"
|
||||
- type: "integer"
|
||||
name: "fp_posts"
|
||||
caption: "Number of published posts to display on front page"
|
||||
param: "1-50"
|
||||
- type: "integer"
|
||||
name: "audit_recs"
|
||||
caption: "Number of audit records to display per page"
|
||||
param: "10-500"
|
||||
- type: "rolelist"
|
||||
name: "create_lvl"
|
||||
caption: "Security level required to create a new community"
|
||||
required: true
|
||||
param: "Global.CreateCommunity"
|
||||
- type: "header"
|
||||
name: "header2"
|
||||
caption: "Community Properties"
|
||||
- type: "integer"
|
||||
name: "comm_mbrs"
|
||||
caption: "Number of community members to display per page"
|
||||
param: "10-100"
|
||||
- type: "checkbox"
|
||||
name: "no_cats"
|
||||
caption: "Disable community categorization system"
|
||||
- type: "header"
|
||||
name: "header2"
|
||||
caption: "Conferencing Properties"
|
||||
- type: "integer"
|
||||
name: "posts_page"
|
||||
caption: "Maximum number of posts to display per page"
|
||||
param: "5-100"
|
||||
- type: "integer"
|
||||
name: "old_posts"
|
||||
caption: "Number of 'old' posts to display at top of page"
|
||||
param: "1-5"
|
||||
- type: "integer"
|
||||
name: "conf_mbrs"
|
||||
caption: "Number of conference members to display per page"
|
||||
param: "10-100"
|
||||
- type: "checkbox"
|
||||
name: "pic_in_post"
|
||||
caption: "Display user pictures next to posts in conference"
|
||||
subcaption: "(by default; user can override)"
|
||||
- type: "button"
|
||||
name: "update"
|
||||
caption: "Update"
|
||||
param: "blue"
|
||||
- type: "button"
|
||||
name: "cancel"
|
||||
caption: "Cancel"
|
||||
param: "red"
|
||||
+1
-1
@@ -34,7 +34,7 @@ menudefs:
|
||||
Use with care and review all changes before applying them to the system.
|
||||
items:
|
||||
- text: "Edit Global Properties"
|
||||
link: "/TODO/sysadmin/global"
|
||||
link: "/sysadmin/globals"
|
||||
permission: "Global.SysAdminAccess"
|
||||
- text: "View/Edit IP Address Bans"
|
||||
link: "/TODO/sysadmin/ip_bans"
|
||||
|
||||
Reference in New Issue
Block a user