Added the possibility to have feed aggregation as embedded view using "?view=embedded".
Convenient to include the feed aggregation in a page with for instance jquery load(..) function.
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
note
|
note
|
||||||
description: "CMS module bringing support for feed aggregation."
|
description: "CMS module bringing support for feed aggregation."
|
||||||
date: "$Date$"
|
date: "$Date: 2016-12-21 15:17:16 +0100 (mer., 21 déc. 2016) $"
|
||||||
revision: "$Revision$"
|
revision: "$Revision: 99686 $"
|
||||||
|
|
||||||
class
|
class
|
||||||
FEED_AGGREGATOR_MODULE
|
FEED_AGGREGATOR_MODULE
|
||||||
@@ -92,7 +92,8 @@ feature -- Handle
|
|||||||
|
|
||||||
handle_feed_aggregation (a_api: CMS_API; req: WSF_REQUEST; res: WSF_RESPONSE)
|
handle_feed_aggregation (a_api: CMS_API; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
local
|
local
|
||||||
r: CMS_RESPONSE
|
m: WSF_PAGE_RESPONSE
|
||||||
|
r: detachable CMS_RESPONSE
|
||||||
s: STRING
|
s: STRING
|
||||||
nb: INTEGER
|
nb: INTEGER
|
||||||
do
|
do
|
||||||
@@ -101,9 +102,21 @@ feature -- Handle
|
|||||||
else
|
else
|
||||||
nb := -1
|
nb := -1
|
||||||
end
|
end
|
||||||
create {GENERIC_VIEW_CMS_RESPONSE} r.make (req, res, a_api)
|
|
||||||
if attached {WSF_STRING} req.path_parameter ("feed_id") as p_feed_id then
|
if attached {WSF_STRING} req.path_parameter ("feed_id") as p_feed_id then
|
||||||
if attached feed_aggregation (p_feed_id.value) as l_agg then
|
if attached feed_aggregation (p_feed_id.value) as l_agg then
|
||||||
|
if attached {WSF_STRING} req.query_parameter ("view") as p_view and then p_view.same_string ("embedded") then
|
||||||
|
create {GENERIC_VIEW_CMS_RESPONSE} r.make (req, res, a_api)
|
||||||
|
if attached feed_to_html (p_feed_id.value, nb, True, r) as l_html then
|
||||||
|
r := Void
|
||||||
|
create m.make_with_body (l_html)
|
||||||
|
m.header.put_content_type_text_html
|
||||||
|
res.send (m)
|
||||||
|
else
|
||||||
|
create {NOT_FOUND_ERROR_CMS_RESPONSE} r.make (req, res, a_api)
|
||||||
|
r.execute
|
||||||
|
end
|
||||||
|
else
|
||||||
|
create {GENERIC_VIEW_CMS_RESPONSE} r.make (req, res, a_api)
|
||||||
create s.make_empty
|
create s.make_empty
|
||||||
s.append ("<h1>")
|
s.append ("<h1>")
|
||||||
s.append (r.html_encoded (l_agg.name))
|
s.append (r.html_encoded (l_agg.name))
|
||||||
@@ -139,11 +152,16 @@ feature -- Handle
|
|||||||
if attached feed_to_html (p_feed_id.value, nb, True, r) as l_html then
|
if attached feed_to_html (p_feed_id.value, nb, True, r) as l_html then
|
||||||
s.append (l_html)
|
s.append (l_html)
|
||||||
end
|
end
|
||||||
|
|
||||||
r.set_main_content (s)
|
r.set_main_content (s)
|
||||||
else
|
r.execute
|
||||||
create {NOT_FOUND_ERROR_CMS_RESPONSE} r.make (req, res, a_api)
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
create {NOT_FOUND_ERROR_CMS_RESPONSE} r.make (req, res, a_api)
|
||||||
|
r.execute
|
||||||
|
end
|
||||||
|
else
|
||||||
|
create {GENERIC_VIEW_CMS_RESPONSE} r.make (req, res, a_api)
|
||||||
if attached feed_aggregator_api as l_feed_agg_api then
|
if attached feed_aggregator_api as l_feed_agg_api then
|
||||||
create s.make_empty
|
create s.make_empty
|
||||||
across
|
across
|
||||||
@@ -175,9 +193,9 @@ feature -- Handle
|
|||||||
else
|
else
|
||||||
create {BAD_REQUEST_ERROR_CMS_RESPONSE} r.make (req, res, a_api)
|
create {BAD_REQUEST_ERROR_CMS_RESPONSE} r.make (req, res, a_api)
|
||||||
end
|
end
|
||||||
end
|
|
||||||
r.execute
|
r.execute
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
feature -- Hooks configuration
|
feature -- Hooks configuration
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user