Added feed aggregation module.

Redesigned the CMS_BLOCK system,
   - added condition attribute. It can be set via configuration file
     with
     [blocks]
      {blockid}.region={region_name}
      {blockid}.conditions[]=is_front
      {blockid}.conditions[]=path:location-path/foo/bar
   - For backward compatibility, the CMS will check only conditions for block name prefixed by "?".
Improved the configuration library to support list and table properties.
Updated theme for now, to include the feed examples.
Added "cache" classes, to ease caching of html output for instance. (TODO: improve by providing a cache manager).
This commit is contained in:
2015-10-08 13:56:31 +02:00
parent abebd00a4f
commit 463105f29f
32 changed files with 1504 additions and 108 deletions

View File

@@ -6,11 +6,12 @@ note
class
CMS_BLOCK_EXPRESSION_CONDITION
inherit
inherit
CMS_BLOCK_CONDITION
create
make
make,
make_none
feature {NONE} -- Initialization
@@ -19,9 +20,14 @@ feature {NONE} -- Initialization
expression := a_exp
end
make_none
do
make ("<none>")
end
feature -- Access
description: READABLE_STRING_32
description: STRING_32
do
create Result.make_from_string_general ("Expression: %"")
Result.append_string_general (expression)
@@ -33,10 +39,18 @@ feature -- Access
feature -- Evaluation
satisfied_for_response (res: CMS_RESPONSE): BOOLEAN
local
exp: like expression
do
if expression.same_string ("is_front") then
exp := expression
if exp.same_string ("is_front") then
Result := res.is_front
elseif expression.starts_with ("path=") then
elseif exp.same_string ("*") then
Result := True
elseif exp.same_string ("<none>") then
Result := False
elseif exp.starts_with ("path:") then
Result := res.location.same_string (exp.substring (6, exp.count))
end
end

View File

@@ -0,0 +1,45 @@
note
description: "Condition for block to be displayed based on location."
date: "$Date$"
revision: "$Revision$"
class
CMS_BLOCK_LOCATION_CONDITION
inherit
CMS_BLOCK_CONDITION
create
make_with_location
feature {NONE} -- Initialization
make_with_location (a_location: READABLE_STRING_8)
do
location := a_location
end
feature -- Access
description: STRING_32
do
create Result.make_from_string_general ("Location: %"")
Result.append_string_general (location)
Result.append_character ('%"')
end
location: STRING
feature -- Evaluation
satisfied_for_response (res: CMS_RESPONSE): BOOLEAN
local
loc: like location
do
Result := res.location.same_string (loc)
end
note
copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
end

View File

@@ -70,6 +70,19 @@ feature -- Element change
opts.remove_css_class (a_class)
end
add_condition (a_condition: CMS_BLOCK_CONDITION)
-- Add condition `a_condition'.
local
l_conditions: like conditions
do
l_conditions := conditions
if l_conditions = Void then
create {ARRAYED_LIST [CMS_BLOCK_CONDITION]} l_conditions.make (1)
conditions := l_conditions
end
l_conditions.force (a_condition)
end
feature -- Conversion
to_html (a_theme: CMS_THEME): STRING_8