Added webapi system and first attempt for the core webapi.
Added user profile system to the core module.
Moved /user/{uid} from auth module to core module.
Added possibility to add html before and after a cms form. (useful to add a form before or after, as nested form are forbidden).
Now theme can be installed using roc install command.
This commit is contained in:
@@ -124,8 +124,6 @@ feature -- Router
|
||||
a_router.handle ("/account/new-password", create {WSF_URI_AGENT_HANDLER}.make (agent handle_new_password(a_api, ?, ?)), a_router.methods_get_post)
|
||||
a_router.handle ("/account/reset-password", create {WSF_URI_AGENT_HANDLER}.make (agent handle_reset_password(a_api, ?, ?)), a_router.methods_get_post)
|
||||
a_router.handle ("/account/change/{field}", create {WSF_URI_TEMPLATE_AGENT_HANDLER}.make (agent handle_change_field (a_api, ?, ?)), a_router.methods_get_post)
|
||||
|
||||
a_router.handle ("/user/{uid}", create {CMS_USER_HANDLER}.make (a_api), a_router.methods_get)
|
||||
end
|
||||
|
||||
feature -- Hooks configuration
|
||||
@@ -214,10 +212,13 @@ feature -- Handler
|
||||
l_user: detachable CMS_USER
|
||||
b: STRING
|
||||
lnk: CMS_LOCAL_LINK
|
||||
f: CMS_FORM
|
||||
tf: WSF_FORM_TEXT_INPUT
|
||||
do
|
||||
create {GENERIC_VIEW_CMS_RESPONSE} r.make (req, res, api)
|
||||
create b.make_empty
|
||||
l_user := r.user
|
||||
create f.make (r.location, "roccms-user-view")
|
||||
if attached smarty_template_block (Current, "account_info", api) as l_tpl_block then
|
||||
l_tpl_block.set_weight (-10)
|
||||
r.add_block (l_tpl_block, "content")
|
||||
@@ -225,6 +226,30 @@ feature -- Handler
|
||||
debug ("cms")
|
||||
r.add_warning_message ("Error with block [resources_page]")
|
||||
end
|
||||
if l_user /= Void then
|
||||
create tf.make_with_text ("username", l_user.name)
|
||||
tf.set_label ("Username")
|
||||
f.extend (tf)
|
||||
if attached l_user.email as l_email then
|
||||
create tf.make_with_text ("email", l_email.to_string_32)
|
||||
tf.set_label ("Email")
|
||||
f.extend (tf)
|
||||
end
|
||||
if attached l_user.profile_name as l_prof_name then
|
||||
create tf.make_with_text ("profile_name", l_prof_name)
|
||||
tf.set_label ("Profile name")
|
||||
f.extend (tf)
|
||||
end
|
||||
create tf.make_with_text ("creation", api.formatted_date_time_yyyy_mm_dd (l_user.creation_date))
|
||||
tf.set_label ("Creation date")
|
||||
f.extend (tf)
|
||||
|
||||
if attached l_user.last_login_date as dt then
|
||||
create tf.make_with_text ("last_login", api.formatted_date_time_ago (dt))
|
||||
tf.set_label ("Last login")
|
||||
f.extend (tf)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if r.is_authenticated then
|
||||
@@ -237,6 +262,9 @@ feature -- Handler
|
||||
r.add_to_primary_tabs (lnk)
|
||||
end
|
||||
|
||||
api.hooks.invoke_form_alter (f, Void, r)
|
||||
f.append_to_html (r.wsf_theme, b)
|
||||
|
||||
r.set_main_content (b)
|
||||
|
||||
if l_user = Void then
|
||||
@@ -251,10 +279,12 @@ feature -- Handler
|
||||
l_user: detachable CMS_USER
|
||||
b: STRING
|
||||
lnk: CMS_LOCAL_LINK
|
||||
l_form: CMS_FORM
|
||||
do
|
||||
create {GENERIC_VIEW_CMS_RESPONSE} r.make (req, res, api)
|
||||
create b.make_empty
|
||||
l_user := r.user
|
||||
create l_form.make (r.location, "roccms-user-edit")
|
||||
if attached smarty_template_block (Current, "account_edit", api) as l_tpl_block then
|
||||
l_tpl_block.set_weight (-10)
|
||||
r.add_block (l_tpl_block, "content")
|
||||
@@ -262,6 +292,7 @@ feature -- Handler
|
||||
debug ("cms")
|
||||
r.add_warning_message ("Error with block [resources_page]")
|
||||
end
|
||||
-- Build CMS form...
|
||||
end
|
||||
create lnk.make ("View", "account/")
|
||||
lnk.set_weight (1)
|
||||
@@ -287,6 +318,8 @@ feature -- Handler
|
||||
f.append_to_html (r.wsf_theme, b)
|
||||
end
|
||||
|
||||
l_form.append_to_html (r.wsf_theme, b)
|
||||
|
||||
r.set_main_content (b)
|
||||
|
||||
if l_user = Void then
|
||||
|
||||
Reference in New Issue
Block a user