factored out the need for amsterdam_pageTitle by having FrameTitle be a separate bit of metadata in AmContext

This commit is contained in:
2026-02-10 21:10:20 -07:00
parent 09842a91bd
commit f2b8b829aa
18 changed files with 65 additions and 46 deletions
+4 -4
View File
@@ -132,7 +132,7 @@ func ShowCommunity(ctxt ui.AmContext) (string, any) {
ctxt.VarMap().Set("homePage", *ci.URL) 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" return "framed", "comprofile.jet"
} }
@@ -246,7 +246,7 @@ func UnjoinCommunity(ctxt ui.AmContext) (string, any) {
return "error", ENOUNJOIN return "error", ENOUNJOIN
} }
ctxt.VarMap().Set("comm", comm) ctxt.VarMap().Set("comm", comm)
ctxt.VarMap().Set("amsterdam_pageTitle", "Unjoin Community") ctxt.SetFrameTitle("Unjoin Community")
return "framed", "unjoin.jet" return "framed", "unjoin.jet"
} }
@@ -310,7 +310,7 @@ func MemberList(ctxt ui.AmContext) (string, any) {
ctxt.VarMap().Set("oper", "st") ctxt.VarMap().Set("oper", "st")
ctxt.VarMap().Set("term", "") ctxt.VarMap().Set("term", "")
ctxt.VarMap().Set("ofs", ofs) ctxt.VarMap().Set("ofs", ofs)
ctxt.VarMap().Set("amsterdam_pageTitle", "List Members") ctxt.SetFrameTitle("List Members")
listMax := int(ctxt.Globals().MaxCommunityMemberPage) listMax := int(ctxt.Globals().MaxCommunityMemberPage)
results, total, err := comm.ListMembers(ctxt.Ctx(), database.ListMembersFieldNone, database.ListMembersOperNone, "", ofs*listMax, listMax, showHidden) results, total, err := comm.ListMembers(ctxt.Ctx(), database.ListMembersFieldNone, database.ListMembersOperNone, "", ofs*listMax, listMax, showHidden)
if err != nil { if err != nil {
@@ -355,7 +355,7 @@ func MemberSearch(ctxt ui.AmContext) (string, any) {
ctxt.VarMap().Set("oper", oper) ctxt.VarMap().Set("oper", oper)
ctxt.VarMap().Set("term", term) ctxt.VarMap().Set("term", term)
ctxt.VarMap().Set("ofs", ofs) ctxt.VarMap().Set("ofs", ofs)
ctxt.VarMap().Set("amsterdam_pageTitle", "Search for Members") ctxt.SetFrameTitle("Search for Members")
var iField, iOper int var iField, iOper int
switch field { switch field {
case "name": case "name":
+3 -3
View File
@@ -44,7 +44,7 @@ func CommunityAdminMenu(ctxt ui.AmContext) (string, any) {
} }
ctxt.VarMap().Set("menu", menu.FilterCommunity(comm)) ctxt.VarMap().Set("menu", menu.FilterCommunity(comm))
ctxt.VarMap().Set("defs", defs) ctxt.VarMap().Set("defs", defs)
ctxt.VarMap().Set("amsterdam_pageTitle", menu.Title+" - "+comm.Name) ctxt.SetFrameTitle(menu.Title + " - " + comm.Name)
return "framed", "menu.jet" return "framed", "menu.jet"
} }
@@ -257,7 +257,7 @@ func CommunityLogoForm(ctxt ui.AmContext) (string, any) {
ctxt.VarMap().Set("commName", comm.Name) ctxt.VarMap().Set("commName", comm.Name)
ctxt.VarMap().Set("commAlias", comm.Alias) ctxt.VarMap().Set("commAlias", comm.Alias)
ctxt.VarMap().Set("logo_url", communityLogoURL(ci)) 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 "framed", "logo_upload.jet"
} }
return "error", err return "error", err
@@ -310,7 +310,7 @@ func EditCommunityLogo(ctxt ui.AmContext) (string, any) {
ctxt.VarMap().Set("commName", comm.Name) ctxt.VarMap().Set("commName", comm.Name)
ctxt.VarMap().Set("commAlias", comm.Alias) ctxt.VarMap().Set("commAlias", comm.Alias)
ctxt.VarMap().Set("logo_url", communityLogoURL(ci)) 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 "framed", "logo_upload.jet"
} }
if ctxt.FormFieldIsSet("remove") { if ctxt.FormFieldIsSet("remove") {
+9 -9
View File
@@ -39,7 +39,7 @@ func Conferences(ctxt ui.AmContext) (string, any) {
comm := ctxt.CurrentCommunity() comm := ctxt.CurrentCommunity()
ctxt.VarMap().Set("commName", comm.Name) ctxt.VarMap().Set("commName", comm.Name)
ctxt.VarMap().Set("commAlias", comm.Alias) 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, clist, err := database.AmGetCommunityConferences(ctxt.Ctx(), comm.Id,
comm.TestPermission("Community.ShowHiddenObjects", ctxt.EffectiveLevel())) comm.TestPermission("Community.ShowHiddenObjects", ctxt.EffectiveLevel()))
if err != nil { if err != nil {
@@ -149,7 +149,7 @@ func Topics(ctxt ui.AmContext) (string, any) {
ctxt.VarMap().Set("sort", sort) ctxt.VarMap().Set("sort", sort)
ctxt.VarMap().Set("topics", topics) ctxt.VarMap().Set("topics", topics)
ctxt.VarMap().Set("formattedDate", fdate) ctxt.VarMap().Set("formattedDate", fdate)
ctxt.VarMap().Set("amsterdam_pageTitle", "Topics in "+conf.Name) ctxt.SetFrameTitle("Topics in " + conf.Name)
return "framed", "topiclist.jet" return "framed", "topiclist.jet"
} }
@@ -176,7 +176,7 @@ func NewTopicForm(ctxt ui.AmContext) (string, any) {
} }
ctxt.VarMap().Set("pseud", pseud) ctxt.VarMap().Set("pseud", pseud)
ctxt.VarMap().Set("pb", "") ctxt.VarMap().Set("pb", "")
ctxt.VarMap().Set("amsterdam_pageTitle", "Create New Topic") ctxt.SetFrameTitle("Create New Topic")
return "framed", "new_topic.jet" 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("conferenceName", conf.Name)
ctxt.VarMap().Set("urlStem", urlStem) ctxt.VarMap().Set("urlStem", urlStem)
ctxt.VarMap().Set("amsterdam_pageTitle", "Preview New Topic") ctxt.SetFrameTitle("Preview New Topic")
return "framed", "new_topic.jet" return "framed", "new_topic.jet"
} }
if ctxt.FormFieldIsSet("post1") { if ctxt.FormFieldIsSet("post1") {
@@ -289,7 +289,7 @@ func NewTopic(ctxt ui.AmContext) (string, any) {
// go upload the attachment // go upload the attachment
ctxt.VarMap().Set("target", urlStem) ctxt.VarMap().Set("target", urlStem)
ctxt.VarMap().Set("post", post.PostId) ctxt.VarMap().Set("post", post.PostId)
ctxt.VarMap().Set("amsterdam_pageTitle", "Upload Attachment") ctxt.SetFrameTitle("Upload Attachment")
return "framed", "attachment_upload.jet" 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)) 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("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) plc := database.AmCreatePostLinkContext("", ctxt.GetScratch("currentAlias").(string), topic.Number)
ctxt.VarMap().Set("post_confRef", plc.AsString()) ctxt.VarMap().Set("post_confRef", plc.AsString())
plc.Community = comm.Alias 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("maxPost", ctxt.FormField("xp"))
ctxt.VarMap().Set("urlStem", urlStem) ctxt.VarMap().Set("urlStem", urlStem)
ctxt.VarMap().Set("amsterdam_pageTitle", "Previewing Message") ctxt.SetFrameTitle("Previewing Message")
return "framed", "preview_post.jet" return "framed", "preview_post.jet"
} }
// Figure out which URL to return to once this post is made. // 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("post_max", topic.TopMessage)
ctxt.VarMap().Set("posts", posts) ctxt.VarMap().Set("posts", posts)
ctxt.VarMap().Set("topicName", topic.Name) 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" return "framed", "slippage.jet"
} }
@@ -792,6 +792,6 @@ func PostInTopic(ctxt ui.AmContext) (string, any) {
// go upload the attachment // go upload the attachment
ctxt.VarMap().Set("target", returnURL) ctxt.VarMap().Set("target", returnURL)
ctxt.VarMap().Set("post", hdr.PostId) ctxt.VarMap().Set("post", hdr.PostId)
ctxt.VarMap().Set("amsterdam_pageTitle", "Upload Attachment") ctxt.SetFrameTitle("Upload Attachment")
return "framed", "attachment_upload.jet" return "framed", "attachment_upload.jet"
} }
+4 -4
View File
@@ -73,8 +73,8 @@ func AttachmentUpload(ctxt ui.AmContext) (string, any) {
ctxt.VarMap().Set("target", target) ctxt.VarMap().Set("target", target)
ctxt.VarMap().Set("post", postId) ctxt.VarMap().Set("post", postId)
ctxt.VarMap().Set("amsterdam_pageTitle", "Upload Attachment")
ctxt.VarMap().Set("errorMessage", err.Error()) ctxt.VarMap().Set("errorMessage", err.Error())
ctxt.SetFrameTitle("Upload Attachment")
return "framed", "attachment_upload.jet" return "framed", "attachment_upload.jet"
} }
return "error", EBUTTON return "error", EBUTTON
@@ -160,7 +160,7 @@ func ConfManage(ctxt ui.AmContext) (string, any) {
ctxt.VarMap().Set("menu", menu) 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" return "framed", "manage_conf.jet"
} }
@@ -514,7 +514,7 @@ func MoveMessageForm(ctxt ui.AmContext) (string, any) {
ctxt.VarMap().Set("topMessage", topic.TopMessage) 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) 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("formLink", formLink)
ctxt.VarMap().Set("amsterdam_pageTitle", "Move Message") ctxt.SetFrameTitle("Move Message")
return "framed", "move_message.jet" return "framed", "move_message.jet"
} }
@@ -656,7 +656,7 @@ func TopicManage(ctxt ui.AmContext) (string, any) {
} }
ctxt.VarMap().Set("bozos", bozos) 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" return "framed", "manage_topic.jet"
} }
+3 -3
View File
@@ -140,7 +140,7 @@ func ConferenceAliasForm(ctxt ui.AmContext) (string, any) {
ctxt.VarMap().Set("confName", conf.Name) 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("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("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") { if ctxt.HasParameter("del") {
err := conf.RemoveAlias(ctxt.Ctx(), ctxt.Parameter("del"), ctxt.CurrentUser(), ctxt.RemoteIP()) 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("confName", conf.Name)
ctxt.VarMap().Set("backLink", fmt.Sprintf("/comm/%s/conf/%s/manage", comm.Alias, ctxt.GetScratch("currentAlias"))) 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("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") newAlias := ctxt.FormField("na")
ctxt.VarMap().Set("newAlias", newAlias) 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("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("selfLink", fmt.Sprintf("/comm/%s/conf/%s/members", comm.Alias, ctxt.GetScratch("currentAlias")))
ctxt.VarMap().Set("roleList", database.AmRoleList("Conference.UserLevels")) 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. // Get the search parameter values and adjust them.
mode := "conf" mode := "conf"
+1 -1
View File
@@ -43,7 +43,7 @@ var EPARAM error = errors.New("no parameters specified")
*/ */
func NotImplPage(ctxt ui.AmContext) (string, any) { func NotImplPage(ctxt ui.AmContext) (string, any) {
ctxt.SetLeftMenu("top") ctxt.SetLeftMenu("top")
ctxt.VarMap().Set("amsterdam_pageTitle", "Function Not Implemented") ctxt.SetFrameTitle("Function Not Implemented")
ctxt.VarMap().Set("path", ctxt.URLPath()) ctxt.VarMap().Set("path", ctxt.URLPath())
return "framed", "notimpl.jet" return "framed", "notimpl.jet"
} }
+4 -4
View File
@@ -143,7 +143,7 @@ func FindPage(ctxt ui.AmContext) (string, any) {
ctxt.VarMap().Set("term", "") ctxt.VarMap().Set("term", "")
} }
ctxt.VarMap().Set("amsterdam_pageTitle", "Find") ctxt.SetFrameTitle("Find")
ctxt.SetLeftMenu("top") ctxt.SetLeftMenu("top")
return "framed", "find.jet" return "framed", "find.jet"
} }
@@ -167,7 +167,7 @@ func Find(ctxt ui.AmContext) (string, any) {
ctxt.VarMap().Set("oper", oper) ctxt.VarMap().Set("oper", oper)
term := ctxt.FormField("term") term := ctxt.FormField("term")
ctxt.VarMap().Set("term", term) ctxt.VarMap().Set("term", term)
ctxt.VarMap().Set("amsterdam_pageTitle", "Find") ctxt.SetFrameTitle("Find")
ctxt.SetLeftMenu("top") ctxt.SetLeftMenu("top")
ofs, _ := ctxt.FormFieldInt("ofs") ofs, _ := ctxt.FormFieldInt("ofs")
if ctxt.FormFieldIsSet("search") { if ctxt.FormFieldIsSet("search") {
@@ -315,7 +315,7 @@ func commonFindGetBackend(ctxt ui.AmContext) (string, any) {
} }
ctxt.VarMap().Set("ofs", ofs) ctxt.VarMap().Set("ofs", ofs)
ctxt.VarMap().Set("term", "") ctxt.VarMap().Set("term", "")
ctxt.VarMap().Set("amsterdam_pageTitle", "Find Posts") ctxt.SetFrameTitle("Find Posts")
return "framed", "find_posts.jet" 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) { func commonFindPostBackend(ctxt ui.AmContext, comm *database.Community, conf *database.Conference, topic *database.Topic) (string, any) {
term := ctxt.FormField("term") term := ctxt.FormField("term")
ctxt.VarMap().Set("term", term) ctxt.VarMap().Set("term", term)
ctxt.VarMap().Set("amsterdam_pageTitle", "Find Posts") ctxt.SetFrameTitle("Find Posts")
ofs, _ := ctxt.FormFieldInt("ofs") ofs, _ := ctxt.FormFieldInt("ofs")
if ctxt.FormFieldIsSet("search") { if ctxt.FormFieldIsSet("search") {
ofs = 0 ofs = 0
+3 -3
View File
@@ -32,7 +32,7 @@ func InviteToCommunity(ctxt ui.AmContext) (string, any) {
} }
comm := ctxt.CurrentCommunity() comm := ctxt.CurrentCommunity()
ctxt.VarMap().Set("amsterdam_pageTitle", "Send Invitation") ctxt.SetFrameTitle("Send Invitation")
ctxt.VarMap().Set("title", "Send Community Invitation") ctxt.VarMap().Set("title", "Send Community Invitation")
ctxt.VarMap().Set("subtitle", comm.Name) ctxt.VarMap().Set("subtitle", comm.Name)
ctxt.VarMap().Set("backlink", fmt.Sprintf("/comm/%s/profile", comm.Alias)) 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() comm := ctxt.CurrentCommunity()
conf := ctxt.GetScratch("currentConference").(*database.Conference) 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("title", "Send Conference Invitation")
ctxt.VarMap().Set("subtitle", conf.Name) ctxt.VarMap().Set("subtitle", conf.Name)
ctxt.VarMap().Set("backlink", fmt.Sprintf("/comm/%s/conf/%s/manage", comm.Alias, ctxt.GetScratch("currentAlias"))) 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) conf := ctxt.GetScratch("currentConference").(*database.Conference)
topic := ctxt.GetScratch("currentTopic").(*database.Topic) 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("title", "Send Topic Invitation")
ctxt.VarMap().Set("subtitle", topic.Name) 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)) ctxt.VarMap().Set("backlink", fmt.Sprintf("/comm/%s/conf/%s/op/%d/manage", comm.Alias, ctxt.GetScratch("currentAlias"), topic.Number))
+2 -2
View File
@@ -287,8 +287,8 @@ func NewAccountUserAgreement(ctxt ui.AmContext) (string, any) {
ctxt.SetLeftMenu("top") ctxt.SetLeftMenu("top")
ctxt.VarMap().Set("target", target) ctxt.VarMap().Set("target", target)
ctxt.VarMap().Set("amsterdam_pageTitle", "New Account User Agreement")
ctxt.VarMap().Set("amsterdam_suppressLogin", true) ctxt.VarMap().Set("amsterdam_suppressLogin", true)
ctxt.SetFrameTitle("New Account User Agreement")
return "framed", "agreement.jet" return "framed", "agreement.jet"
} }
@@ -441,7 +441,7 @@ func PasswordRecovery(ctxt ui.AmContext) (string, any) {
msg.AddVariable("password", newpass) msg.AddVariable("password", newpass)
msg.Send() msg.Send()
ctxt.SetLeftMenu("top") 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" return "framed", "password_changed.jet"
} }
} }
+1 -1
View File
@@ -30,6 +30,6 @@ func SysAdminMenu(ctxt ui.AmContext) (string, any) {
menu := ui.AmMenu("sysadmin") menu := ui.AmMenu("sysadmin")
ctxt.VarMap().Set("menu", menu) ctxt.VarMap().Set("menu", menu)
ctxt.VarMap().Set("defs", make(map[string]bool)) ctxt.VarMap().Set("defs", make(map[string]bool))
ctxt.VarMap().Set("amsterdam_pageTitle", menu.Title) ctxt.SetFrameTitle(menu.Title)
return "framed", "menu.jet" return "framed", "menu.jet"
} }
+2 -2
View File
@@ -236,7 +236,7 @@ func templateTopicLink(args jet.Arguments) reflect.Value {
*/ */
func TopPage(ctxt ui.AmContext) (string, any) { func TopPage(ctxt ui.AmContext) (string, any) {
// Set the page title. // Set the page title.
ctxt.VarMap().Set("amsterdam_pageTitle", "My Front Page") ctxt.SetFrameTitle("My Front Page")
// Retrieve the published posts. // Retrieve the published posts.
hdrs, err := database.AmGetPublishedPosts(ctxt.Ctx()) hdrs, err := database.AmGetPublishedPosts(ctxt.Ctx())
@@ -281,7 +281,7 @@ func TopPage(ctxt ui.AmContext) (string, any) {
*/ */
func AboutPage(ctxt ui.AmContext) (string, any) { func AboutPage(ctxt ui.AmContext) (string, any) {
// Set the page title. // Set the page title.
ctxt.VarMap().Set("amsterdam_pageTitle", "About Amsterdam") ctxt.SetFrameTitle("About Amsterdam")
return "framed", "about.jet" return "framed", "about.jet"
} }
+15
View File
@@ -46,6 +46,7 @@ type AmContext interface {
FormFieldInt(string) (int, error) FormFieldInt(string) (int, error)
FormFieldIsSet(string) bool FormFieldIsSet(string) bool
FormFile(string) (*multipart.FileHeader, error) FormFile(string) (*multipart.FileHeader, error)
FrameTitle() string
Globals() *database.Globals Globals() *database.Globals
GlobalFlags() *util.OptionSet GlobalFlags() *util.OptionSet
HasParameter(string) bool HasParameter(string) bool
@@ -59,6 +60,7 @@ type AmContext interface {
ReplaceUser(*database.User) ReplaceUser(*database.User)
SaveSession() error SaveSession() error
SetCommunityContext(string) error SetCommunityContext(string) error
SetFrameTitle(string)
SetHeader(string, string) SetHeader(string, string)
SetLeftMenu(string) SetLeftMenu(string)
SetLoginCookie(string) SetLoginCookie(string)
@@ -85,6 +87,7 @@ type AmContext interface {
type amContext struct { type amContext struct {
echoContext echo.Context echoContext echo.Context
rendervars jet.VarMap rendervars jet.VarMap
frameTitle string
outputType string outputType string
session AmSession session AmSession
globals *database.Globals globals *database.Globals
@@ -219,6 +222,11 @@ func (c *amContext) FormFile(name string) (*multipart.FileHeader, error) {
return c.echoContext.FormFile(name) 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. // Globals returns a reference to the database globals.
func (c *amContext) Globals() *database.Globals { func (c *amContext) Globals() *database.Globals {
return c.globals return c.globals
@@ -343,6 +351,11 @@ func (c *amContext) SetCommunityContext(param string) error {
return nil 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. // SetHeader sets a header on the output.
func (c *amContext) SetHeader(key, value string) { func (c *amContext) SetHeader(key, value string) {
c.echoContext.Response().Header().Set(key, value) c.echoContext.Response().Header().Set(key, value)
@@ -457,6 +470,7 @@ func newContext(ctxt echo.Context) (*amContext, error) {
if rc == nil { if rc == nil {
rc = &amContext{ rc = &amContext{
rendervars: make(jet.VarMap), rendervars: make(jet.VarMap),
frameTitle: "",
outputType: "", outputType: "",
} }
} }
@@ -531,6 +545,7 @@ func contextRecycler(incoming chan *amContext, done chan bool) {
for c := range incoming { for c := range incoming {
c.echoContext = nil c.echoContext = nil
c.rendervars = make(jet.VarMap) c.rendervars = make(jet.VarMap)
c.frameTitle = ""
c.outputType = "" c.outputType = ""
c.session = nil c.session = nil
c.globals = nil c.globals = nil
+1 -1
View File
@@ -318,7 +318,7 @@ func (d *Dialog) Render(ctxt AmContext) (string, any) {
} }
ctxt.VarMap().Set("amsterdam_required", required) ctxt.VarMap().Set("amsterdam_required", required)
ctxt.VarMap().Set("amsterdam_dialog", d) ctxt.VarMap().Set("amsterdam_dialog", d)
ctxt.VarMap().Set("amsterdam_pageTitle", d.Title) ctxt.SetFrameTitle(d.Title)
if strings.Contains(d.Options, "suppresslogin") { if strings.Contains(d.Options, "suppresslogin") {
ctxt.VarMap().Set("amsterdam_suppressLogin", true) ctxt.VarMap().Set("amsterdam_suppressLogin", true)
} }
+1 -1
View File
@@ -124,7 +124,7 @@ func (mb *MessageBox) Render(ctxt AmContext) (string, any) {
} }
ctxt.SetSession("mbconfirm."+mb.def.Id, nonce) 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("tone", mb.def.Tone)
ctxt.VarMap().Set("destructive", mb.def.Destructive) ctxt.VarMap().Set("destructive", mb.def.Destructive)
ctxt.VarMap().Set("message", mb.message) ctxt.VarMap().Set("message", mb.message)
+6 -2
View File
@@ -68,12 +68,12 @@ func AmSendPageData(ctxt echo.Context, amctxt AmContext, command string, data an
if httprc < 400 { if httprc < 400 {
httprc = http.StatusInternalServerError httprc = http.StatusInternalServerError
} }
amctxt.VarMap().Set("amsterdam_pageTitle", "Internal Server Error") amctxt.SetFrameTitle("Internal Server Error")
amctxt.VarMap().Set("error", message) amctxt.VarMap().Set("error", message)
command = "framed" command = "framed"
data = "error.jet" data = "error.jet"
case "ipban": case "ipban":
amctxt.VarMap().Set("amsterdam_pageTitle", "IP Address Banned") amctxt.SetFrameTitle("IP Address Banned")
amctxt.VarMap().Set("message", data) amctxt.VarMap().Set("message", data)
httprc = http.StatusForbidden httprc = http.StatusForbidden
command = "framed" command = "framed"
@@ -92,6 +92,10 @@ func AmSendPageData(ctxt echo.Context, amctxt AmContext, command string, data an
case "template": case "template":
err = ctxt.Render(httprc, data.(string), amctxt) err = ctxt.Render(httprc, data.(string), amctxt)
case "framed": 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) amctxt.VarMap().Set("amsterdam_innerPage", data)
menus := make([]*MenuDefinition, 2) menus := make([]*MenuDefinition, 2)
switch amctxt.LeftMenu() { switch amctxt.LeftMenu() {
+1 -1
View File
@@ -11,7 +11,7 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ amsterdam_pageTitle | raw }} - {{ GlobalConfig.Site.Title }}</title> <title>{{ .FrameTitle() | raw }} - {{ GlobalConfig.Site.Title }}</title>
<link rel="icon" href="/img/builtin/AmsterdamIcon32.png" type="image/png" /> <link rel="icon" href="/img/builtin/AmsterdamIcon32.png" type="image/png" />
<link rel="shortcut icon" href="/img/builtin/AmsterdamIcon32.ico" /> <link rel="shortcut icon" href="/img/builtin/AmsterdamIcon32.ico" />
{{ if isset(amsterdam_genRefresh) && GlobalConfig.Site.TopRefresh > 0 }} {{ if isset(amsterdam_genRefresh) && GlobalConfig.Site.TopRefresh > 0 }}
+1 -1
View File
@@ -14,7 +14,7 @@
<div class="bg-{{ tone }}-600 px-6 py-4"> <div class="bg-{{ tone }}-600 px-6 py-4">
<h1 class="text-white text-2xl font-bold text-center flex items-center justify-center gap-3"> <h1 class="text-white text-2xl font-bold text-center flex items-center justify-center gap-3">
{{ if destructive }}<span class="text-3xl">⚠️</span>{{ end }} {{ if destructive }}<span class="text-3xl">⚠️</span>{{ end }}
{{ amsterdam_pageTitle }} {{ .FrameTitle() | raw }}
{{ if destructive }}<span class="text-3xl">⚠️</span>{{ end }} {{ if destructive }}<span class="text-3xl">⚠️</span>{{ end }}
</h1> </h1>
</div> </div>
+4 -4
View File
@@ -225,8 +225,8 @@ func ProfilePhotoForm(ctxt ui.AmContext) (string, any) {
if err == nil { if err == nil {
ctxt.VarMap().Set("target", target) ctxt.VarMap().Set("target", target)
ctxt.VarMap().Set("photo_url", userPhotoURL(ci)) ctxt.VarMap().Set("photo_url", userPhotoURL(ci))
ctxt.VarMap().Set("amsterdam_pageTitle", "Upload User Photo")
ctxt.VarMap().Set("amsterdam_suppressLogin", true) ctxt.VarMap().Set("amsterdam_suppressLogin", true)
ctxt.SetFrameTitle("Upload User Photo")
return "framed", "photo_upload.jet" return "framed", "photo_upload.jet"
} }
return "error", err return "error", err
@@ -278,8 +278,8 @@ func ProfilePhoto(ctxt ui.AmContext) (string, any) {
ctxt.VarMap().Set("errorMessage", err.Error()) ctxt.VarMap().Set("errorMessage", err.Error())
ctxt.VarMap().Set("target", target) ctxt.VarMap().Set("target", target)
ctxt.VarMap().Set("photo_url", userPhotoURL(ci)) ctxt.VarMap().Set("photo_url", userPhotoURL(ci))
ctxt.VarMap().Set("amsterdam_pageTitle", "Upload User Photo")
ctxt.VarMap().Set("amsterdam_suppressLogin", true) ctxt.VarMap().Set("amsterdam_suppressLogin", true)
ctxt.SetFrameTitle("Upload User Photo")
return "framed", "photo_upload.jet" return "framed", "photo_upload.jet"
} }
if ctxt.FormFieldIsSet("remove") { if ctxt.FormFieldIsSet("remove") {
@@ -427,7 +427,7 @@ func ShowProfile(ctxt ui.AmContext) (string, any) {
if !pvtPhone && ci.Mobile != nil { if !pvtPhone && ci.Mobile != nil {
ctxt.VarMap().Set("mobile", *ci.Mobile) 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" return "framed", "profile.jet"
} }
@@ -532,6 +532,6 @@ func Hotlist(ctxt ui.AmContext) (string, any) {
ctxt.VarMap().Set("hotlist", hotlist) ctxt.VarMap().Set("hotlist", hotlist)
ctxt.VarMap().Set("communities", communities) ctxt.VarMap().Set("communities", communities)
ctxt.VarMap().Set("conferences", conferences) ctxt.VarMap().Set("conferences", conferences)
ctxt.VarMap().Set("amsterdam_pageTitle", "Your Conference Hotlist") ctxt.SetFrameTitle("Your Conference Hotlist")
return "framed", "hotlist.jet" return "framed", "hotlist.jet"
} }