From f2b8b829aa97ee8044cece1135fbb2b553441139 Mon Sep 17 00:00:00 2001 From: Amy Gale Ruth Bowersox Date: Tue, 10 Feb 2026 21:10:20 -0700 Subject: [PATCH] factored out the need for amsterdam_pageTitle by having FrameTitle be a separate bit of metadata in AmContext --- community.go | 8 ++++---- communityadmin.go | 6 +++--- conference.go | 18 +++++++++--------- conference_ops.go | 8 ++++---- conferenceadmin.go | 6 +++--- errors.go | 2 +- find.go | 8 ++++---- invites.go | 6 +++--- login.go | 4 ++-- sysadmin.go | 2 +- top.go | 4 ++-- ui/amcontext.go | 15 +++++++++++++++ ui/dialog.go | 2 +- ui/messagebox.go | 2 +- ui/render_wrap.go | 8 ++++++-- ui/views/frame.jet | 2 +- ui/views/messagebox.jet | 2 +- userdata.go | 8 ++++---- 18 files changed, 65 insertions(+), 46 deletions(-) diff --git a/community.go b/community.go index db9907b..f1a245b 100644 --- a/community.go +++ b/community.go @@ -132,7 +132,7 @@ func ShowCommunity(ctxt ui.AmContext) (string, any) { ctxt.VarMap().Set("homePage", *ci.URL) } - ctxt.VarMap().Set("amsterdam_pageTitle", "Community Profile: "+comm.Name) + ctxt.SetFrameTitle("Community Profile: " + comm.Name) return "framed", "comprofile.jet" } @@ -246,7 +246,7 @@ func UnjoinCommunity(ctxt ui.AmContext) (string, any) { return "error", ENOUNJOIN } ctxt.VarMap().Set("comm", comm) - ctxt.VarMap().Set("amsterdam_pageTitle", "Unjoin Community") + ctxt.SetFrameTitle("Unjoin Community") return "framed", "unjoin.jet" } @@ -310,7 +310,7 @@ func MemberList(ctxt ui.AmContext) (string, any) { ctxt.VarMap().Set("oper", "st") ctxt.VarMap().Set("term", "") ctxt.VarMap().Set("ofs", ofs) - ctxt.VarMap().Set("amsterdam_pageTitle", "List Members") + ctxt.SetFrameTitle("List Members") listMax := int(ctxt.Globals().MaxCommunityMemberPage) results, total, err := comm.ListMembers(ctxt.Ctx(), database.ListMembersFieldNone, database.ListMembersOperNone, "", ofs*listMax, listMax, showHidden) if err != nil { @@ -355,7 +355,7 @@ func MemberSearch(ctxt ui.AmContext) (string, any) { ctxt.VarMap().Set("oper", oper) ctxt.VarMap().Set("term", term) ctxt.VarMap().Set("ofs", ofs) - ctxt.VarMap().Set("amsterdam_pageTitle", "Search for Members") + ctxt.SetFrameTitle("Search for Members") var iField, iOper int switch field { case "name": diff --git a/communityadmin.go b/communityadmin.go index 275bded..61ffec9 100644 --- a/communityadmin.go +++ b/communityadmin.go @@ -44,7 +44,7 @@ func CommunityAdminMenu(ctxt ui.AmContext) (string, any) { } ctxt.VarMap().Set("menu", menu.FilterCommunity(comm)) ctxt.VarMap().Set("defs", defs) - ctxt.VarMap().Set("amsterdam_pageTitle", menu.Title+" - "+comm.Name) + ctxt.SetFrameTitle(menu.Title + " - " + comm.Name) return "framed", "menu.jet" } @@ -257,7 +257,7 @@ func CommunityLogoForm(ctxt ui.AmContext) (string, any) { ctxt.VarMap().Set("commName", comm.Name) ctxt.VarMap().Set("commAlias", comm.Alias) ctxt.VarMap().Set("logo_url", communityLogoURL(ci)) - ctxt.VarMap().Set("amsterdam_pageTitle", "Upload Community Logo: "+comm.Name) + ctxt.SetFrameTitle("Upload Community Logo: " + comm.Name) return "framed", "logo_upload.jet" } return "error", err @@ -310,7 +310,7 @@ func EditCommunityLogo(ctxt ui.AmContext) (string, any) { ctxt.VarMap().Set("commName", comm.Name) ctxt.VarMap().Set("commAlias", comm.Alias) ctxt.VarMap().Set("logo_url", communityLogoURL(ci)) - ctxt.VarMap().Set("amsterdam_pageTitle", "Upload Community Logo: "+comm.Name) + ctxt.SetFrameTitle("Upload Community Logo: " + comm.Name) return "framed", "logo_upload.jet" } if ctxt.FormFieldIsSet("remove") { diff --git a/conference.go b/conference.go index f3652a7..594d957 100644 --- a/conference.go +++ b/conference.go @@ -39,7 +39,7 @@ func Conferences(ctxt ui.AmContext) (string, any) { comm := ctxt.CurrentCommunity() ctxt.VarMap().Set("commName", comm.Name) ctxt.VarMap().Set("commAlias", comm.Alias) - ctxt.VarMap().Set("amsterdam_pageTitle", "Conference Listing: "+comm.Name) + ctxt.SetFrameTitle("Conference Listing: " + comm.Name) clist, err := database.AmGetCommunityConferences(ctxt.Ctx(), comm.Id, comm.TestPermission("Community.ShowHiddenObjects", ctxt.EffectiveLevel())) if err != nil { @@ -149,7 +149,7 @@ func Topics(ctxt ui.AmContext) (string, any) { ctxt.VarMap().Set("sort", sort) ctxt.VarMap().Set("topics", topics) ctxt.VarMap().Set("formattedDate", fdate) - ctxt.VarMap().Set("amsterdam_pageTitle", "Topics in "+conf.Name) + ctxt.SetFrameTitle("Topics in " + conf.Name) return "framed", "topiclist.jet" } @@ -176,7 +176,7 @@ func NewTopicForm(ctxt ui.AmContext) (string, any) { } ctxt.VarMap().Set("pseud", pseud) ctxt.VarMap().Set("pb", "") - ctxt.VarMap().Set("amsterdam_pageTitle", "Create New Topic") + ctxt.SetFrameTitle("Create New Topic") return "framed", "new_topic.jet" } @@ -243,7 +243,7 @@ func NewTopic(ctxt ui.AmContext) (string, any) { } ctxt.VarMap().Set("conferenceName", conf.Name) ctxt.VarMap().Set("urlStem", urlStem) - ctxt.VarMap().Set("amsterdam_pageTitle", "Preview New Topic") + ctxt.SetFrameTitle("Preview New Topic") return "framed", "new_topic.jet" } if ctxt.FormFieldIsSet("post1") { @@ -289,7 +289,7 @@ func NewTopic(ctxt ui.AmContext) (string, any) { // go upload the attachment ctxt.VarMap().Set("target", urlStem) ctxt.VarMap().Set("post", post.PostId) - ctxt.VarMap().Set("amsterdam_pageTitle", "Upload Attachment") + ctxt.SetFrameTitle("Upload Attachment") return "framed", "attachment_upload.jet" } @@ -525,7 +525,7 @@ func ReadPosts(ctxt ui.AmContext) (string, any) { } summaryLine := fmt.Sprintf("%d Total; %d New; Last: %s", topic.TopMessage+1, topic.TopMessage-lastRead, prefs.Localizer().Strftime("%b %e, %Y %r", topic.LastUpdate)) ctxt.VarMap().Set("summaryLine", flags.String()+summaryLine) - ctxt.VarMap().Set("amsterdam_pageTitle", fmt.Sprintf("%s: %s%s", topic.Name, flags.String(), summaryLine)) + ctxt.SetFrameTitle(fmt.Sprintf("%s: %s%s", topic.Name, flags.String(), summaryLine)) plc := database.AmCreatePostLinkContext("", ctxt.GetScratch("currentAlias").(string), topic.Number) ctxt.VarMap().Set("post_confRef", plc.AsString()) plc.Community = comm.Alias @@ -698,7 +698,7 @@ func PostInTopic(ctxt ui.AmContext) (string, any) { ctxt.VarMap().Set("maxPost", ctxt.FormField("xp")) ctxt.VarMap().Set("urlStem", urlStem) - ctxt.VarMap().Set("amsterdam_pageTitle", "Previewing Message") + ctxt.SetFrameTitle("Previewing Message") return "framed", "preview_post.jet" } // Figure out which URL to return to once this post is made. @@ -741,7 +741,7 @@ func PostInTopic(ctxt ui.AmContext) (string, any) { ctxt.VarMap().Set("post_max", topic.TopMessage) ctxt.VarMap().Set("posts", posts) ctxt.VarMap().Set("topicName", topic.Name) - ctxt.VarMap().Set("amsterdam_pageTitle", "Slippage or Double-Click Detected") + ctxt.SetFrameTitle("Slippage or Double-Click Detected") return "framed", "slippage.jet" } @@ -792,6 +792,6 @@ func PostInTopic(ctxt ui.AmContext) (string, any) { // go upload the attachment ctxt.VarMap().Set("target", returnURL) ctxt.VarMap().Set("post", hdr.PostId) - ctxt.VarMap().Set("amsterdam_pageTitle", "Upload Attachment") + ctxt.SetFrameTitle("Upload Attachment") return "framed", "attachment_upload.jet" } diff --git a/conference_ops.go b/conference_ops.go index 3dcb8a9..405862b 100644 --- a/conference_ops.go +++ b/conference_ops.go @@ -73,8 +73,8 @@ func AttachmentUpload(ctxt ui.AmContext) (string, any) { ctxt.VarMap().Set("target", target) ctxt.VarMap().Set("post", postId) - ctxt.VarMap().Set("amsterdam_pageTitle", "Upload Attachment") ctxt.VarMap().Set("errorMessage", err.Error()) + ctxt.SetFrameTitle("Upload Attachment") return "framed", "attachment_upload.jet" } return "error", EBUTTON @@ -160,7 +160,7 @@ func ConfManage(ctxt ui.AmContext) (string, any) { ctxt.VarMap().Set("menu", menu) } - ctxt.VarMap().Set("amsterdam_pageTitle", "Manage Conference: "+conf.Name) + ctxt.SetFrameTitle("Manage Conference: " + conf.Name) return "framed", "manage_conf.jet" } @@ -514,7 +514,7 @@ func MoveMessageForm(ctxt ui.AmContext) (string, any) { ctxt.VarMap().Set("topMessage", topic.TopMessage) formLink := fmt.Sprintf("/comm/%s/conf/%s/op/%d/move/%d", ctxt.CurrentCommunity().Alias, ctxt.GetScratch("currentAlias"), topic.Number, hdrs[0].Num) ctxt.VarMap().Set("formLink", formLink) - ctxt.VarMap().Set("amsterdam_pageTitle", "Move Message") + ctxt.SetFrameTitle("Move Message") return "framed", "move_message.jet" } @@ -656,7 +656,7 @@ func TopicManage(ctxt ui.AmContext) (string, any) { } ctxt.VarMap().Set("bozos", bozos) - ctxt.VarMap().Set("amsterdam_pageTitle", "Manage Topic: "+topic.Name) + ctxt.SetFrameTitle("Manage Topic: " + topic.Name) return "framed", "manage_topic.jet" } diff --git a/conferenceadmin.go b/conferenceadmin.go index a4cbe56..590aaa1 100644 --- a/conferenceadmin.go +++ b/conferenceadmin.go @@ -140,7 +140,7 @@ func ConferenceAliasForm(ctxt ui.AmContext) (string, any) { ctxt.VarMap().Set("confName", conf.Name) ctxt.VarMap().Set("backLink", fmt.Sprintf("/comm/%s/conf/%s/manage", comm.Alias, ctxt.GetScratch("currentAlias"))) ctxt.VarMap().Set("selfLink", fmt.Sprintf("/comm/%s/conf/%s/aliases", comm.Alias, ctxt.GetScratch("currentAlias"))) - ctxt.VarMap().Set("amsterdam_pageTitle", fmt.Sprintf("Manage Conference Aliases: %s", conf.Name)) + ctxt.SetFrameTitle(fmt.Sprintf("Manage Conference Aliases: %s", conf.Name)) if ctxt.HasParameter("del") { err := conf.RemoveAlias(ctxt.Ctx(), ctxt.Parameter("del"), ctxt.CurrentUser(), ctxt.RemoteIP()) @@ -176,7 +176,7 @@ func ConferenceAliasAdd(ctxt ui.AmContext) (string, any) { ctxt.VarMap().Set("confName", conf.Name) ctxt.VarMap().Set("backLink", fmt.Sprintf("/comm/%s/conf/%s/manage", comm.Alias, ctxt.GetScratch("currentAlias"))) ctxt.VarMap().Set("selfLink", fmt.Sprintf("/comm/%s/conf/%s/aliases", comm.Alias, ctxt.GetScratch("currentAlias"))) - ctxt.VarMap().Set("amsterdam_pageTitle", fmt.Sprintf("Manage Conference Aliases: %s", conf.Name)) + ctxt.SetFrameTitle(fmt.Sprintf("Manage Conference Aliases: %s", conf.Name)) newAlias := ctxt.FormField("na") ctxt.VarMap().Set("newAlias", newAlias) @@ -248,7 +248,7 @@ func ConferenceMembers(ctxt ui.AmContext) (string, any) { ctxt.VarMap().Set("backLink", fmt.Sprintf("/comm/%s/conf/%s/manage", comm.Alias, ctxt.GetScratch("currentAlias"))) ctxt.VarMap().Set("selfLink", fmt.Sprintf("/comm/%s/conf/%s/members", comm.Alias, ctxt.GetScratch("currentAlias"))) ctxt.VarMap().Set("roleList", database.AmRoleList("Conference.UserLevels")) - ctxt.VarMap().Set("amsterdam_pageTitle", fmt.Sprintf("Membership in Conference: %s", conf.Name)) + ctxt.SetFrameTitle(fmt.Sprintf("Membership in Conference: %s", conf.Name)) // Get the search parameter values and adjust them. mode := "conf" diff --git a/errors.go b/errors.go index e15421c..c9ffd94 100644 --- a/errors.go +++ b/errors.go @@ -43,7 +43,7 @@ var EPARAM error = errors.New("no parameters specified") */ func NotImplPage(ctxt ui.AmContext) (string, any) { ctxt.SetLeftMenu("top") - ctxt.VarMap().Set("amsterdam_pageTitle", "Function Not Implemented") + ctxt.SetFrameTitle("Function Not Implemented") ctxt.VarMap().Set("path", ctxt.URLPath()) return "framed", "notimpl.jet" } diff --git a/find.go b/find.go index 7b4d58e..8481ae9 100644 --- a/find.go +++ b/find.go @@ -143,7 +143,7 @@ func FindPage(ctxt ui.AmContext) (string, any) { ctxt.VarMap().Set("term", "") } - ctxt.VarMap().Set("amsterdam_pageTitle", "Find") + ctxt.SetFrameTitle("Find") ctxt.SetLeftMenu("top") return "framed", "find.jet" } @@ -167,7 +167,7 @@ func Find(ctxt ui.AmContext) (string, any) { ctxt.VarMap().Set("oper", oper) term := ctxt.FormField("term") ctxt.VarMap().Set("term", term) - ctxt.VarMap().Set("amsterdam_pageTitle", "Find") + ctxt.SetFrameTitle("Find") ctxt.SetLeftMenu("top") ofs, _ := ctxt.FormFieldInt("ofs") if ctxt.FormFieldIsSet("search") { @@ -315,7 +315,7 @@ func commonFindGetBackend(ctxt ui.AmContext) (string, any) { } ctxt.VarMap().Set("ofs", ofs) ctxt.VarMap().Set("term", "") - ctxt.VarMap().Set("amsterdam_pageTitle", "Find Posts") + ctxt.SetFrameTitle("Find Posts") return "framed", "find_posts.jet" } @@ -373,7 +373,7 @@ func FindPostsPageTopic(ctxt ui.AmContext) (string, any) { func commonFindPostBackend(ctxt ui.AmContext, comm *database.Community, conf *database.Conference, topic *database.Topic) (string, any) { term := ctxt.FormField("term") ctxt.VarMap().Set("term", term) - ctxt.VarMap().Set("amsterdam_pageTitle", "Find Posts") + ctxt.SetFrameTitle("Find Posts") ofs, _ := ctxt.FormFieldInt("ofs") if ctxt.FormFieldIsSet("search") { ofs = 0 diff --git a/invites.go b/invites.go index ffde654..7b63459 100644 --- a/invites.go +++ b/invites.go @@ -32,7 +32,7 @@ func InviteToCommunity(ctxt ui.AmContext) (string, any) { } comm := ctxt.CurrentCommunity() - ctxt.VarMap().Set("amsterdam_pageTitle", "Send Invitation") + ctxt.SetFrameTitle("Send Invitation") ctxt.VarMap().Set("title", "Send Community Invitation") ctxt.VarMap().Set("subtitle", comm.Name) ctxt.VarMap().Set("backlink", fmt.Sprintf("/comm/%s/profile", comm.Alias)) @@ -54,7 +54,7 @@ func InviteToConference(ctxt ui.AmContext) (string, any) { comm := ctxt.CurrentCommunity() conf := ctxt.GetScratch("currentConference").(*database.Conference) - ctxt.VarMap().Set("amsterdam_pageTitle", "Send Invitation") + ctxt.SetFrameTitle("Send Invitation") ctxt.VarMap().Set("title", "Send Conference Invitation") ctxt.VarMap().Set("subtitle", conf.Name) ctxt.VarMap().Set("backlink", fmt.Sprintf("/comm/%s/conf/%s/manage", comm.Alias, ctxt.GetScratch("currentAlias"))) @@ -78,7 +78,7 @@ func InviteToTopic(ctxt ui.AmContext) (string, any) { conf := ctxt.GetScratch("currentConference").(*database.Conference) topic := ctxt.GetScratch("currentTopic").(*database.Topic) - ctxt.VarMap().Set("amsterdam_pageTitle", "Send Invitation") + ctxt.SetFrameTitle("Send Invitation") ctxt.VarMap().Set("title", "Send Topic Invitation") ctxt.VarMap().Set("subtitle", topic.Name) ctxt.VarMap().Set("backlink", fmt.Sprintf("/comm/%s/conf/%s/op/%d/manage", comm.Alias, ctxt.GetScratch("currentAlias"), topic.Number)) diff --git a/login.go b/login.go index 4d2fc88..e73ac51 100644 --- a/login.go +++ b/login.go @@ -287,8 +287,8 @@ func NewAccountUserAgreement(ctxt ui.AmContext) (string, any) { ctxt.SetLeftMenu("top") ctxt.VarMap().Set("target", target) - ctxt.VarMap().Set("amsterdam_pageTitle", "New Account User Agreement") ctxt.VarMap().Set("amsterdam_suppressLogin", true) + ctxt.SetFrameTitle("New Account User Agreement") return "framed", "agreement.jet" } @@ -441,7 +441,7 @@ func PasswordRecovery(ctxt ui.AmContext) (string, any) { msg.AddVariable("password", newpass) msg.Send() ctxt.SetLeftMenu("top") - ctxt.VarMap().Set("amsterdam_pageTitle", "Your Password Has Been Changed") + ctxt.SetFrameTitle("Your Password Has Been Changed") return "framed", "password_changed.jet" } } diff --git a/sysadmin.go b/sysadmin.go index 8f979f5..74f9ba4 100644 --- a/sysadmin.go +++ b/sysadmin.go @@ -30,6 +30,6 @@ func SysAdminMenu(ctxt ui.AmContext) (string, any) { menu := ui.AmMenu("sysadmin") ctxt.VarMap().Set("menu", menu) ctxt.VarMap().Set("defs", make(map[string]bool)) - ctxt.VarMap().Set("amsterdam_pageTitle", menu.Title) + ctxt.SetFrameTitle(menu.Title) return "framed", "menu.jet" } diff --git a/top.go b/top.go index 88622b8..5f9d464 100644 --- a/top.go +++ b/top.go @@ -236,7 +236,7 @@ func templateTopicLink(args jet.Arguments) reflect.Value { */ func TopPage(ctxt ui.AmContext) (string, any) { // Set the page title. - ctxt.VarMap().Set("amsterdam_pageTitle", "My Front Page") + ctxt.SetFrameTitle("My Front Page") // Retrieve the published posts. hdrs, err := database.AmGetPublishedPosts(ctxt.Ctx()) @@ -281,7 +281,7 @@ func TopPage(ctxt ui.AmContext) (string, any) { */ func AboutPage(ctxt ui.AmContext) (string, any) { // Set the page title. - ctxt.VarMap().Set("amsterdam_pageTitle", "About Amsterdam") + ctxt.SetFrameTitle("About Amsterdam") return "framed", "about.jet" } diff --git a/ui/amcontext.go b/ui/amcontext.go index 68aac84..9cc3a03 100644 --- a/ui/amcontext.go +++ b/ui/amcontext.go @@ -46,6 +46,7 @@ type AmContext interface { FormFieldInt(string) (int, error) FormFieldIsSet(string) bool FormFile(string) (*multipart.FileHeader, error) + FrameTitle() string Globals() *database.Globals GlobalFlags() *util.OptionSet HasParameter(string) bool @@ -59,6 +60,7 @@ type AmContext interface { ReplaceUser(*database.User) SaveSession() error SetCommunityContext(string) error + SetFrameTitle(string) SetHeader(string, string) SetLeftMenu(string) SetLoginCookie(string) @@ -85,6 +87,7 @@ type AmContext interface { type amContext struct { echoContext echo.Context rendervars jet.VarMap + frameTitle string outputType string session AmSession globals *database.Globals @@ -219,6 +222,11 @@ func (c *amContext) FormFile(name string) (*multipart.FileHeader, error) { return c.echoContext.FormFile(name) } +// FrameTitle returns the frame title. +func (c *amContext) FrameTitle() string { + return c.frameTitle +} + // Globals returns a reference to the database globals. func (c *amContext) Globals() *database.Globals { return c.globals @@ -343,6 +351,11 @@ func (c *amContext) SetCommunityContext(param string) error { return nil } +// SetFrameTitle sets the frame title for the output. +func (c *amContext) SetFrameTitle(s string) { + c.frameTitle = s +} + // SetHeader sets a header on the output. func (c *amContext) SetHeader(key, value string) { c.echoContext.Response().Header().Set(key, value) @@ -457,6 +470,7 @@ func newContext(ctxt echo.Context) (*amContext, error) { if rc == nil { rc = &amContext{ rendervars: make(jet.VarMap), + frameTitle: "", outputType: "", } } @@ -531,6 +545,7 @@ func contextRecycler(incoming chan *amContext, done chan bool) { for c := range incoming { c.echoContext = nil c.rendervars = make(jet.VarMap) + c.frameTitle = "" c.outputType = "" c.session = nil c.globals = nil diff --git a/ui/dialog.go b/ui/dialog.go index 4a5b1b7..4d4341d 100644 --- a/ui/dialog.go +++ b/ui/dialog.go @@ -318,7 +318,7 @@ func (d *Dialog) Render(ctxt AmContext) (string, any) { } ctxt.VarMap().Set("amsterdam_required", required) ctxt.VarMap().Set("amsterdam_dialog", d) - ctxt.VarMap().Set("amsterdam_pageTitle", d.Title) + ctxt.SetFrameTitle(d.Title) if strings.Contains(d.Options, "suppresslogin") { ctxt.VarMap().Set("amsterdam_suppressLogin", true) } diff --git a/ui/messagebox.go b/ui/messagebox.go index fd8305f..0d0853a 100644 --- a/ui/messagebox.go +++ b/ui/messagebox.go @@ -124,7 +124,7 @@ func (mb *MessageBox) Render(ctxt AmContext) (string, any) { } ctxt.SetSession("mbconfirm."+mb.def.Id, nonce) } - ctxt.VarMap().Set("amsterdam_pageTitle", mb.def.Title) + ctxt.SetFrameTitle(mb.def.Title) ctxt.VarMap().Set("tone", mb.def.Tone) ctxt.VarMap().Set("destructive", mb.def.Destructive) ctxt.VarMap().Set("message", mb.message) diff --git a/ui/render_wrap.go b/ui/render_wrap.go index e2084c5..69272b4 100644 --- a/ui/render_wrap.go +++ b/ui/render_wrap.go @@ -68,12 +68,12 @@ func AmSendPageData(ctxt echo.Context, amctxt AmContext, command string, data an if httprc < 400 { httprc = http.StatusInternalServerError } - amctxt.VarMap().Set("amsterdam_pageTitle", "Internal Server Error") + amctxt.SetFrameTitle("Internal Server Error") amctxt.VarMap().Set("error", message) command = "framed" data = "error.jet" case "ipban": - amctxt.VarMap().Set("amsterdam_pageTitle", "IP Address Banned") + amctxt.SetFrameTitle("IP Address Banned") amctxt.VarMap().Set("message", data) httprc = http.StatusForbidden command = "framed" @@ -92,6 +92,10 @@ func AmSendPageData(ctxt echo.Context, amctxt AmContext, command string, data an case "template": err = ctxt.Render(httprc, data.(string), amctxt) case "framed": + if amctxt.FrameTitle() == "" { + ctxt.Logger().Errorf("*** NO FRAME TITLE set for path %s", amctxt.URLPath()) + amctxt.SetFrameTitle("<<< NO FRAME TITLE >>>") + } amctxt.VarMap().Set("amsterdam_innerPage", data) menus := make([]*MenuDefinition, 2) switch amctxt.LeftMenu() { diff --git a/ui/views/frame.jet b/ui/views/frame.jet index 7e69c32..774bf0a 100644 --- a/ui/views/frame.jet +++ b/ui/views/frame.jet @@ -11,7 +11,7 @@ - {{ amsterdam_pageTitle | raw }} - {{ GlobalConfig.Site.Title }} + {{ .FrameTitle() | raw }} - {{ GlobalConfig.Site.Title }} {{ if isset(amsterdam_genRefresh) && GlobalConfig.Site.TopRefresh > 0 }} diff --git a/ui/views/messagebox.jet b/ui/views/messagebox.jet index ffb2558..8113145 100644 --- a/ui/views/messagebox.jet +++ b/ui/views/messagebox.jet @@ -14,7 +14,7 @@

{{ if destructive }}⚠️{{ end }} - {{ amsterdam_pageTitle }} + {{ .FrameTitle() | raw }} {{ if destructive }}⚠️{{ end }}

diff --git a/userdata.go b/userdata.go index f9dd7b8..f70b0e3 100644 --- a/userdata.go +++ b/userdata.go @@ -225,8 +225,8 @@ func ProfilePhotoForm(ctxt ui.AmContext) (string, any) { if err == nil { ctxt.VarMap().Set("target", target) ctxt.VarMap().Set("photo_url", userPhotoURL(ci)) - ctxt.VarMap().Set("amsterdam_pageTitle", "Upload User Photo") ctxt.VarMap().Set("amsterdam_suppressLogin", true) + ctxt.SetFrameTitle("Upload User Photo") return "framed", "photo_upload.jet" } return "error", err @@ -278,8 +278,8 @@ func ProfilePhoto(ctxt ui.AmContext) (string, any) { ctxt.VarMap().Set("errorMessage", err.Error()) ctxt.VarMap().Set("target", target) ctxt.VarMap().Set("photo_url", userPhotoURL(ci)) - ctxt.VarMap().Set("amsterdam_pageTitle", "Upload User Photo") ctxt.VarMap().Set("amsterdam_suppressLogin", true) + ctxt.SetFrameTitle("Upload User Photo") return "framed", "photo_upload.jet" } if ctxt.FormFieldIsSet("remove") { @@ -427,7 +427,7 @@ func ShowProfile(ctxt ui.AmContext) (string, any) { if !pvtPhone && ci.Mobile != nil { ctxt.VarMap().Set("mobile", *ci.Mobile) } - ctxt.VarMap().Set("amsterdam_pageTitle", fmt.Sprintf("User Profile - %s", user.Username)) + ctxt.SetFrameTitle(fmt.Sprintf("User Profile - %s", user.Username)) return "framed", "profile.jet" } @@ -532,6 +532,6 @@ func Hotlist(ctxt ui.AmContext) (string, any) { ctxt.VarMap().Set("hotlist", hotlist) ctxt.VarMap().Set("communities", communities) ctxt.VarMap().Set("conferences", conferences) - ctxt.VarMap().Set("amsterdam_pageTitle", "Your Conference Hotlist") + ctxt.SetFrameTitle("Your Conference Hotlist") return "framed", "hotlist.jet" }