landed Find Posts in Community/Conference/Topic
This commit is contained in:
@@ -20,7 +20,7 @@ _(italicized items can be deferred)_
|
|||||||
- System Audit Logs
|
- System Audit Logs
|
||||||
- Import User Accounts
|
- Import User Accounts
|
||||||
- Conferences list:
|
- Conferences list:
|
||||||
- Find
|
- ~~Find~~
|
||||||
- Manage (reorder/show/hide/delete)
|
- Manage (reorder/show/hide/delete)
|
||||||
- Create New
|
- Create New
|
||||||
- Community Admin Menu:
|
- Community Admin Menu:
|
||||||
@@ -35,8 +35,8 @@ _(italicized items can be deferred)_
|
|||||||
- _Policy page_
|
- _Policy page_
|
||||||
- Member List: Export
|
- Member List: Export
|
||||||
- HTML reference for post boxes
|
- HTML reference for post boxes
|
||||||
- Posts view:
|
- ~~Posts view:~~
|
||||||
- Find
|
- ~~Find~~
|
||||||
- ~~Manage:~~
|
- ~~Manage:~~
|
||||||
- ~~Subscribe to Topic~~
|
- ~~Subscribe to Topic~~
|
||||||
- ~~Send invite~~
|
- ~~Send invite~~
|
||||||
@@ -56,7 +56,7 @@ _(italicized items can be deferred)_
|
|||||||
- ~~Manage on Conference Hotlist sidebox~~
|
- ~~Manage on Conference Hotlist sidebox~~
|
||||||
- Sidebox configuration
|
- Sidebox configuration
|
||||||
- Topics view:
|
- Topics view:
|
||||||
- Find
|
- ~~Find~~
|
||||||
- Manage:
|
- Manage:
|
||||||
- ~~Set pseud~~
|
- ~~Set pseud~~
|
||||||
- ~~Fixseen~~
|
- ~~Fixseen~~
|
||||||
|
|||||||
@@ -305,6 +305,7 @@ func Find(ctxt ui.AmContext) (string, any, error) {
|
|||||||
return "framed_template", "find.jet", nil
|
return "framed_template", "find.jet", nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// commonFindGetBackend is the common "back end" function for Find Posts in Community/Conference/Topic.
|
||||||
func commonFindGetBackend(ctxt ui.AmContext) (string, any, error) {
|
func commonFindGetBackend(ctxt ui.AmContext) (string, any, error) {
|
||||||
ofs := 0
|
ofs := 0
|
||||||
p := ctxt.Parameter("ofs")
|
p := ctxt.Parameter("ofs")
|
||||||
@@ -320,6 +321,14 @@ func commonFindGetBackend(ctxt ui.AmContext) (string, any, error) {
|
|||||||
return "framed_template", "find_posts.jet", nil
|
return "framed_template", "find_posts.jet", nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* FindPostsPageCommunity renders the page for finding posts in a community.
|
||||||
|
* 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 FindPostsPageCommunity(ctxt ui.AmContext) (string, any, error) {
|
func FindPostsPageCommunity(ctxt ui.AmContext) (string, any, error) {
|
||||||
comm := ctxt.CurrentCommunity()
|
comm := ctxt.CurrentCommunity()
|
||||||
ctxt.VarMap().Set("scope", "community")
|
ctxt.VarMap().Set("scope", "community")
|
||||||
@@ -329,6 +338,14 @@ func FindPostsPageCommunity(ctxt ui.AmContext) (string, any, error) {
|
|||||||
return commonFindGetBackend(ctxt)
|
return commonFindGetBackend(ctxt)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* FindPostsPageConference renders the page for finding posts in a conference.
|
||||||
|
* 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 FindPostsPageConference(ctxt ui.AmContext) (string, any, error) {
|
func FindPostsPageConference(ctxt ui.AmContext) (string, any, error) {
|
||||||
comm := ctxt.CurrentCommunity()
|
comm := ctxt.CurrentCommunity()
|
||||||
conf := ctxt.GetScratch("currentConference").(*database.Conference)
|
conf := ctxt.GetScratch("currentConference").(*database.Conference)
|
||||||
@@ -339,6 +356,14 @@ func FindPostsPageConference(ctxt ui.AmContext) (string, any, error) {
|
|||||||
return commonFindGetBackend(ctxt)
|
return commonFindGetBackend(ctxt)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* FindPostsPageTopic renders the page for finding posts in a topic.
|
||||||
|
* 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 FindPostsPageTopic(ctxt ui.AmContext) (string, any, error) {
|
func FindPostsPageTopic(ctxt ui.AmContext) (string, any, error) {
|
||||||
comm := ctxt.CurrentCommunity()
|
comm := ctxt.CurrentCommunity()
|
||||||
topic := ctxt.GetScratch("currentTopic").(*database.Topic)
|
topic := ctxt.GetScratch("currentTopic").(*database.Topic)
|
||||||
@@ -348,3 +373,96 @@ func FindPostsPageTopic(ctxt ui.AmContext) (string, any, error) {
|
|||||||
ctxt.VarMap().Set("postlink", fmt.Sprintf("/comm/%s/conf/%s/op/%d/find", comm.Alias, ctxt.GetScratch("currentAlias"), topic.Number))
|
ctxt.VarMap().Set("postlink", fmt.Sprintf("/comm/%s/conf/%s/op/%d/find", comm.Alias, ctxt.GetScratch("currentAlias"), topic.Number))
|
||||||
return commonFindGetBackend(ctxt)
|
return commonFindGetBackend(ctxt)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// commonFindPostBackend is the common "back end" function for Find Posts in Community/Conference/Topic.
|
||||||
|
func commonFindPostBackend(ctxt ui.AmContext, comm *database.Community, conf *database.Conference, topic *database.Topic) (string, any, error) {
|
||||||
|
term := ctxt.FormField("term")
|
||||||
|
ctxt.VarMap().Set("term", term)
|
||||||
|
ctxt.VarMap().Set("amsterdam_pageTitle", "Find Posts")
|
||||||
|
ofs, _ := ctxt.FormFieldInt("ofs")
|
||||||
|
if ctxt.FormFieldIsSet("search") {
|
||||||
|
ofs = 0
|
||||||
|
} else if ctxt.FormFieldIsSet("prev") {
|
||||||
|
ofs -= 1
|
||||||
|
} else if ctxt.FormFieldIsSet("next") {
|
||||||
|
ofs += 1
|
||||||
|
}
|
||||||
|
ctxt.VarMap().Set("ofs", ofs)
|
||||||
|
listMax := int(ctxt.Globals().MaxSearchPage)
|
||||||
|
var numResults int
|
||||||
|
postlist, total, err := database.AmSearchPosts(ctxt.Ctx(), term, ctxt.CurrentUser(), ofs*listMax, listMax, comm, conf, topic)
|
||||||
|
if err == nil {
|
||||||
|
numResults = len(postlist)
|
||||||
|
ctxt.VarMap().Set("resultList", postlist)
|
||||||
|
} else {
|
||||||
|
ctxt.VarMap().Set("errorMessage", err.Error())
|
||||||
|
return "framed_template", "find_posts.jet", nil
|
||||||
|
}
|
||||||
|
if numResults == 0 {
|
||||||
|
ctxt.VarMap().Set("resultHeader", "Search Results: (None)")
|
||||||
|
} else {
|
||||||
|
ctxt.VarMap().Set("resultHeader", fmt.Sprintf("Search Results: Displaying %d-%d of %d",
|
||||||
|
ofs*listMax+1, ofs*listMax+numResults, total))
|
||||||
|
if ofs > 0 {
|
||||||
|
ctxt.VarMap().Set("resultShowPrev", true)
|
||||||
|
}
|
||||||
|
if ofs*listMax+numResults < total {
|
||||||
|
ctxt.VarMap().Set("resultShowNext", true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "framed_template", "find_posts.jet", nil
|
||||||
|
}
|
||||||
|
|
||||||
|
/* FindPostsCommunity finds posts in a community.
|
||||||
|
* 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 FindPostsCommunity(ctxt ui.AmContext) (string, any, error) {
|
||||||
|
comm := ctxt.CurrentCommunity()
|
||||||
|
ctxt.VarMap().Set("scope", "community")
|
||||||
|
ctxt.VarMap().Set("entityName", comm.Name)
|
||||||
|
ctxt.VarMap().Set("backlink", fmt.Sprintf("/comm/%s/conf", comm.Alias))
|
||||||
|
ctxt.VarMap().Set("postlink", fmt.Sprintf("/comm/%s/find", comm.Alias))
|
||||||
|
return commonFindPostBackend(ctxt, comm, nil, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
/* FindPostsConference finds posts in a conference.
|
||||||
|
* 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 FindPostsConference(ctxt ui.AmContext) (string, any, error) {
|
||||||
|
comm := ctxt.CurrentCommunity()
|
||||||
|
conf := ctxt.GetScratch("currentConference").(*database.Conference)
|
||||||
|
ctxt.VarMap().Set("scope", "conference")
|
||||||
|
ctxt.VarMap().Set("entityName", conf.Name)
|
||||||
|
ctxt.VarMap().Set("backlink", fmt.Sprintf("/comm/%s/conf/%s", comm.Alias, ctxt.GetScratch("currentAlias")))
|
||||||
|
ctxt.VarMap().Set("postlink", fmt.Sprintf("/comm/%s/conf/%s/find", comm.Alias, ctxt.GetScratch("currentAlias")))
|
||||||
|
return commonFindPostBackend(ctxt, comm, conf, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
/* FindPostsTopic finds posts in a topic.
|
||||||
|
* 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 FindPostsTopic(ctxt ui.AmContext) (string, any, error) {
|
||||||
|
comm := ctxt.CurrentCommunity()
|
||||||
|
conf := ctxt.GetScratch("currentConference").(*database.Conference)
|
||||||
|
topic := ctxt.GetScratch("currentTopic").(*database.Topic)
|
||||||
|
ctxt.VarMap().Set("scope", "topic")
|
||||||
|
ctxt.VarMap().Set("entityName", topic.Name)
|
||||||
|
ctxt.VarMap().Set("backlink", fmt.Sprintf("/comm/%s/conf/%s/r/%d", comm.Alias, ctxt.GetScratch("currentAlias"), topic.Number))
|
||||||
|
ctxt.VarMap().Set("postlink", fmt.Sprintf("/comm/%s/conf/%s/op/%d/find", comm.Alias, ctxt.GetScratch("currentAlias"), topic.Number))
|
||||||
|
return commonFindPostBackend(ctxt, comm, conf, topic)
|
||||||
|
}
|
||||||
|
|||||||
@@ -92,6 +92,7 @@ func setupEcho() *echo.Echo {
|
|||||||
commGroup.POST("/members", ui.AmWrap(MemberSearch))
|
commGroup.POST("/members", ui.AmWrap(MemberSearch))
|
||||||
commGroup.GET("/invite", ui.AmWrap(InviteToCommunity))
|
commGroup.GET("/invite", ui.AmWrap(InviteToCommunity))
|
||||||
commGroup.GET("/find", ui.AmWrap(FindPostsPageCommunity))
|
commGroup.GET("/find", ui.AmWrap(FindPostsPageCommunity))
|
||||||
|
commGroup.POST("/find", ui.AmWrap(FindPostsCommunity))
|
||||||
commGroup.GET("/admin", ui.AmWrap(CommunityAdminMenu))
|
commGroup.GET("/admin", ui.AmWrap(CommunityAdminMenu))
|
||||||
commGroup.GET("/admin/profile", ui.AmWrap(CommunityProfileForm))
|
commGroup.GET("/admin/profile", ui.AmWrap(CommunityProfileForm))
|
||||||
commGroup.POST("/admin/profile", ui.AmWrap(EditCommunityProfile))
|
commGroup.POST("/admin/profile", ui.AmWrap(EditCommunityProfile))
|
||||||
@@ -105,6 +106,7 @@ func setupEcho() *echo.Echo {
|
|||||||
confGroup.GET("/new_topic", ui.AmWrap(NewTopicForm))
|
confGroup.GET("/new_topic", ui.AmWrap(NewTopicForm))
|
||||||
confGroup.POST("/new_topic", ui.AmWrap(NewTopic))
|
confGroup.POST("/new_topic", ui.AmWrap(NewTopic))
|
||||||
confGroup.GET("/find", ui.AmWrap(FindPostsPageConference))
|
confGroup.GET("/find", ui.AmWrap(FindPostsPageConference))
|
||||||
|
confGroup.POST("/find", ui.AmWrap(FindPostsConference))
|
||||||
confGroup.GET("/manage", ui.AmWrap(ConfManage))
|
confGroup.GET("/manage", ui.AmWrap(ConfManage))
|
||||||
confGroup.POST("/pseud", ui.AmWrap(SetPseud))
|
confGroup.POST("/pseud", ui.AmWrap(SetPseud))
|
||||||
confGroup.GET("/fixseen", ui.AmWrap(ConfFixseen))
|
confGroup.GET("/fixseen", ui.AmWrap(ConfFixseen))
|
||||||
@@ -114,6 +116,7 @@ func setupEcho() *echo.Echo {
|
|||||||
confGroup.POST("/r/:topic", ui.AmWrap(PostInTopic), ui.SetTopic)
|
confGroup.POST("/r/:topic", ui.AmWrap(PostInTopic), ui.SetTopic)
|
||||||
opsGroup := confGroup.Group("/op/:topic", ui.SetTopic)
|
opsGroup := confGroup.Group("/op/:topic", ui.SetTopic)
|
||||||
opsGroup.GET("/find", ui.AmWrap(FindPostsPageTopic))
|
opsGroup.GET("/find", ui.AmWrap(FindPostsPageTopic))
|
||||||
|
opsGroup.POST("/find", ui.AmWrap(FindPostsTopic))
|
||||||
opsGroup.GET("/hide", ui.AmWrap(HideTopic))
|
opsGroup.GET("/hide", ui.AmWrap(HideTopic))
|
||||||
opsGroup.GET("/freeze", ui.AmWrap(FreezeTopic))
|
opsGroup.GET("/freeze", ui.AmWrap(FreezeTopic))
|
||||||
opsGroup.GET("/archive", ui.AmWrap(ArchiveTopic))
|
opsGroup.GET("/archive", ui.AmWrap(ArchiveTopic))
|
||||||
|
|||||||
+1
-1
@@ -201,7 +201,7 @@
|
|||||||
<div class="text-sm text-black font-bold">{{ resultHeader }}</div>
|
<div class="text-sm text-black font-bold">{{ resultHeader }}</div>
|
||||||
</div>
|
</div>
|
||||||
{{ if isset(resultList) }}
|
{{ if isset(resultList) }}
|
||||||
{{ if mode == "PST" }}
|
{{ if mode == "PST" && len(resultList) > 0 }}
|
||||||
<div class="overflow-x-auto">
|
<div class="overflow-x-auto">
|
||||||
<div class="bg-white border border-gray-300 rounded-lg overflow-hidden">
|
<div class="bg-white border border-gray-300 rounded-lg overflow-hidden">
|
||||||
<table class="w-full">
|
<table class="w-full">
|
||||||
|
|||||||
@@ -79,7 +79,7 @@
|
|||||||
<div class="flex justify-between items-center mb-4">
|
<div class="flex justify-between items-center mb-4">
|
||||||
<div class="text-sm text-black font-bold">{{ resultHeader }}</div>
|
<div class="text-sm text-black font-bold">{{ resultHeader }}</div>
|
||||||
</div>
|
</div>
|
||||||
{{ if isset(resultList) }}
|
{{ if isset(resultList) && len(resultList) > 0 }}
|
||||||
<div class="overflow-x-auto">
|
<div class="overflow-x-auto">
|
||||||
<div class="bg-white border border-gray-300 rounded-lg overflow-hidden">
|
<div class="bg-white border border-gray-300 rounded-lg overflow-hidden">
|
||||||
<table class="w-full">
|
<table class="w-full">
|
||||||
|
|||||||
Reference in New Issue
Block a user