Improved block condition "path:..." by allowing wildchar.
Added weight data to CMS_BLOCK to be able to sort the block lists,
and thus order the display of blocks.
Set negative weight for various core block, so that they appear first as expected.
The weight can be set and overwritten in cms.ini , by pref blocks.{block_id}.weight=integer_weight.
This commit is contained in:
@@ -41,6 +41,8 @@ feature -- Evaluation
|
||||
satisfied_for_response (res: CMS_RESPONSE): BOOLEAN
|
||||
local
|
||||
exp: like expression
|
||||
l_path: READABLE_STRING_8
|
||||
kmp: KMP_WILD
|
||||
do
|
||||
exp := expression
|
||||
if exp.same_string ("is_front") then
|
||||
@@ -50,7 +52,17 @@ feature -- Evaluation
|
||||
elseif exp.same_string ("<none>") then
|
||||
Result := False
|
||||
elseif exp.starts_with ("path:") then
|
||||
Result := res.location.same_string (exp.substring (6, exp.count))
|
||||
l_path := exp.substring (6, exp.count)
|
||||
if l_path.has ('*') then
|
||||
if l_path.index_of ('*', 1) = l_path.count then
|
||||
Result := res.location.starts_with_general (l_path.substring (1, l_path.count - 1))
|
||||
else
|
||||
create kmp.make (l_path, res.location)
|
||||
Result := kmp.pattern_matches
|
||||
end
|
||||
else
|
||||
Result := res.location.same_string (l_path)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user