diff --git a/draft/application/cms/src/cms_execution.e b/draft/application/cms/src/cms_execution.e index 9d1e083e..3211dd83 100644 --- a/draft/application/cms/src/cms_execution.e +++ b/draft/application/cms/src/cms_execution.e @@ -386,11 +386,11 @@ feature -- Generation across a_menu_system as c loop - prepare_menu (c.item) + prepare_links (c.item) end end - prepare_menu (a_menu: CMS_MENU) + prepare_links (a_menu: CMS_LINK_COMPOSITE) local to_remove: ARRAYED_LIST [CMS_LINK] do @@ -399,11 +399,17 @@ feature -- Generation a_menu as c loop if attached {CMS_LOCAL_LINK} c.item as lm then - if not has_permissions (lm.permission_arguments) then + if attached lm.permission_arguments as perms and then not has_permissions (perms) then to_remove.force (lm) else + -- if lm.permission_arguments is Void , this is permitted lm.get_is_active (request) + if attached {CMS_LINK_COMPOSITE} lm as comp then + prepare_links (comp) + end end + elseif attached {CMS_LINK_COMPOSITE} c.item as comp then + prepare_links (comp) end end across diff --git a/draft/application/cms/src/kernel/link/cms_link.e b/draft/application/cms/src/kernel/link/cms_link.e index 51194356..66deadfe 100644 --- a/draft/application/cms/src/kernel/link/cms_link.e +++ b/draft/application/cms/src/kernel/link/cms_link.e @@ -10,6 +10,10 @@ deferred class inherit REFACTORING_HELPER + DEBUG_OUTPUT + + ITERABLE [CMS_LINK] + feature -- Access title: READABLE_STRING_32 @@ -44,4 +48,24 @@ feature -- Query deferred end +feature -- Access + + new_cursor: ITERATION_CURSOR [CMS_LINK] + -- Fresh cursor associated with current structure + do + if attached children as lst then + Result := lst.new_cursor + else + Result := (create {ARRAYED_LIST [CMS_LINK]}.make (0)).new_cursor + end + end + +feature -- Status report + + debug_output: STRING + -- String that should be displayed in debugger to represent `Current'. + do + Result := title.as_string_8 + " -> " + location + end + end diff --git a/draft/application/cms/src/kernel/link/cms_local_link.e b/draft/application/cms/src/kernel/link/cms_local_link.e index 32b34fe8..5bfd0500 100644 --- a/draft/application/cms/src/kernel/link/cms_local_link.e +++ b/draft/application/cms/src/kernel/link/cms_local_link.e @@ -10,6 +10,13 @@ class inherit CMS_LINK + CMS_LINK_COMPOSITE + rename + items as children, + extend as add_link, + remove as remove_link + end + create make @@ -30,8 +37,14 @@ feature -- Status report is_active: BOOLEAN is_expanded: BOOLEAN + do + Result := is_expandable and then internal_is_expanded + end is_expandable: BOOLEAN + do + Result := internal_is_expandable or internal_is_expanded or has_children + end has_children: BOOLEAN do @@ -42,6 +55,10 @@ feature -- Status report children: detachable LIST [CMS_LINK] + internal_is_expandable: BOOLEAN + + internal_is_expanded: BOOLEAN + feature -- Element change add_link (lnk: CMS_LINK) @@ -56,6 +73,19 @@ feature -- Element change lst.force (lnk) end + remove_link (lnk: CMS_LINK) + local + lst: like children + do + lst := children + if lst /= Void then + lst.prune_all (lnk) + if lst.is_empty then + children := Void + end + end + end + set_children (lst: like children) do children := lst @@ -63,18 +93,12 @@ feature -- Element change set_expanded (b: like is_expanded) do - is_expanded := b - if b then - is_expandable := True - end + internal_is_expanded := b end set_expandable (b: like is_expandable) do - is_expandable := b - if not b then - is_expanded := False - end + internal_is_expandable := b end get_is_active (req: WSF_REQUEST) diff --git a/draft/application/cms/src/kernel/link/cms_menu.e b/draft/application/cms/src/kernel/link/cms_menu.e index 67b6bbb2..e766027c 100644 --- a/draft/application/cms/src/kernel/link/cms_menu.e +++ b/draft/application/cms/src/kernel/link/cms_menu.e @@ -8,7 +8,7 @@ class CMS_MENU inherit - ITERABLE [CMS_LINK] + CMS_LINK_COMPOSITE create make,