added CMS widgets demonstration in DEMO_MODULE

This commit is contained in:
Jocelyn Fiat
2013-02-28 19:37:06 +01:00
parent 5dd6079fad
commit ce7be6ea34
2 changed files with 118 additions and 2 deletions

View File

@@ -10,6 +10,10 @@ class
inherit
CMS_MODULE
CMS_HOOK_MENU_ALTER
CMS_HOOK_AUTO_REGISTER
create
make
@@ -30,19 +34,29 @@ feature {CMS_SERVICE} -- Registration
register (a_service: CMS_SERVICE)
do
service := a_service
a_service.map_uri_template ("/demo/widget{/args}", agent handle_widget_demo (a_service, ?, ?))
a_service.map_uri_template ("/demo/date/{arg}", agent handle_date_time_demo (a_service, ?, ?))
a_service.map_uri_template ("/demo/format/{arg}", agent handle_format_demo (a_service, ?, ?))
end
menu_alter (a_menu_system: CMS_MENU_SYSTEM; a_execution: CMS_EXECUTION)
local
lnk: CMS_LOCAL_LINK
-- opts: CMS_API_OPTIONS
do
create lnk.make ("Demo::widget", "/demo/widget/")
a_menu_system.management_menu.extend (lnk)
end
feature -- Hooks
links: HASH_TABLE [CMS_MODULE_LINK, STRING]
-- Link indexed by path
local
-- lnk: CMS_MODULE_LINK
lnk: CMS_MODULE_LINK
do
create Result.make (0)
-- create lnk.make ("Date/time demo")
create lnk.make ("Date/time demo")
-- lnk.set_callback (agent process_date_time_demo, <<"arg">>)
-- Result["/demo/date/{arg}"] := lnk
end
@@ -57,4 +71,9 @@ feature -- Hooks
(create {ANY_CMS_EXECUTION}.make_with_text (req, res, cms, "<h1>Demo::format</h1>")).execute
end
handle_widget_demo (cms: CMS_SERVICE; req: WSF_REQUEST; res: WSF_RESPONSE)
do
(create {DEMO_WIDGET_CMS_EXECUTION}.make (req, res, cms)).execute
end
end