diff --git a/conferenceadmin.go b/conferenceadmin.go index ae4ab6b..105d5ca 100644 --- a/conferenceadmin.go +++ b/conferenceadmin.go @@ -121,3 +121,26 @@ func EditConference(ctxt ui.AmContext) (string, any, error) { return "redirect", fmt.Sprintf("/comm/%s/conf/%s/manage", comm.Alias, ctxt.GetScratch("currentAlias")), nil } + +/* CreateConferenceForm displays the dialog for creating a new 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 CreateConferenceForm(ctxt ui.AmContext) (string, any, error) { + comm := ctxt.CurrentCommunity() + if !comm.TestPermission("Community.Create", ctxt.EffectiveLevel()) { + ctxt.SetRC(http.StatusForbidden) + return ui.ErrorPage(ctxt, ENOPERM) + } + + dlg, err := ui.AmLoadDialog("create_conference") + if err != nil { + return ui.ErrorPage(ctxt, err) + } + dlg.SetCommunity(comm) + return dlg.Render(ctxt) +} diff --git a/main.go b/main.go index f908c94..1eeb7c2 100644 --- a/main.go +++ b/main.go @@ -100,6 +100,7 @@ func setupEcho() *echo.Echo { commGroup.POST("/admin/logo", ui.AmWrap(EditCommunityLogo)) // conference group + commGroup.GET("/create_conf", ui.AmWrap(CreateConferenceForm)) commGroup.GET("/conf", ui.AmWrap(Conferences), ui.ValidateConference) confGroup := commGroup.Group("/conf/:confid", ui.ValidateConference, ui.SetConference) confGroup.GET("", ui.AmWrap(Topics)) diff --git a/ui/dialogs/create_conference.yaml b/ui/dialogs/create_conference.yaml new file mode 100644 index 0000000..cf0dbac --- /dev/null +++ b/ui/dialogs/create_conference.yaml @@ -0,0 +1,53 @@ +# +# 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: "conf.create" +formName: "newconfform" +menuSelector: "community" +title: "Create New Conference" +action: "/comm/[CID]/create_conf" +fields: + - type: "text" + name: "name" + caption: "Conference Name" + required: true + size: 32 + maxlength: 128 + - type: "ams_id" + name: "alias" + caption: "Conference Alias" + required: true + size: 32 + maxlength: 64 + - type: "text" + name: "descr" + caption: "Description" + required: false + size: 32 + maxlength: 255 + - type: "dropdown" + name: "ctype" + caption: "Conference type" + required: true + choices: + - id: "0" + text: "Public" + default: true + - id: "1" + text: "Private" + - type: "checkbox" + name: "hide" + caption: "Hide conference in the community's conference list" + - type: "button" + name: "create" + caption: "Create" + param: "blue" + - type: "button" + name: "cancel" + caption: "Cancel" + param: "red" diff --git a/ui/dialogs/edit_conference.yaml b/ui/dialogs/edit_conference.yaml index 4e70129..9e034b6 100644 --- a/ui/dialogs/edit_conference.yaml +++ b/ui/dialogs/edit_conference.yaml @@ -1,14 +1,6 @@ # # Amsterdam Web Communities System -# Copyright (c) 2025 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/. -# -# -# Amsterdam Web Communities System -# Copyright (c) 2025 Erbosoft Metaverse Design Solutions, All Rights Reserved +# 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 diff --git a/ui/views/conflist.jet b/ui/views/conflist.jet index 9555a39..068ef00 100644 --- a/ui/views/conflist.jet +++ b/ui/views/conflist.jet @@ -63,7 +63,7 @@ {{ end }} {{ if canCreate }} - Create New