Added functionalities to CMS_FORM_.. classes
This commit is contained in:
@@ -102,6 +102,20 @@ feature -- Items
|
|||||||
Result := fields_by_name_from (Current, a_name)
|
Result := fields_by_name_from (Current, a_name)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
items_by_css_id (a_id: READABLE_STRING_GENERAL): detachable LIST [CMS_FORM_ITEM]
|
||||||
|
do
|
||||||
|
Result := items_by_css_id_from (Current, a_id)
|
||||||
|
end
|
||||||
|
|
||||||
|
first_item_by_css_id (a_id: READABLE_STRING_GENERAL): detachable CMS_FORM_ITEM
|
||||||
|
do
|
||||||
|
if attached items_by_css_id_from (Current, a_id) as lst then
|
||||||
|
if not lst.is_empty then
|
||||||
|
Result := lst.first
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
feature {NONE} -- Implementation: Items
|
feature {NONE} -- Implementation: Items
|
||||||
|
|
||||||
container_has_field (a_container: ITERABLE [CMS_FORM_ITEM]; a_name: READABLE_STRING_GENERAL): BOOLEAN
|
container_has_field (a_container: ITERABLE [CMS_FORM_ITEM]; a_name: READABLE_STRING_GENERAL): BOOLEAN
|
||||||
@@ -144,6 +158,35 @@ feature {NONE} -- Implementation: Items
|
|||||||
Result := res
|
Result := res
|
||||||
end
|
end
|
||||||
|
|
||||||
|
items_by_css_id_from (a_container: ITERABLE [CMS_FORM_ITEM]; a_id: READABLE_STRING_GENERAL): detachable ARRAYED_LIST [CMS_FORM_ITEM]
|
||||||
|
local
|
||||||
|
res: detachable ARRAYED_LIST [CMS_FORM_ITEM]
|
||||||
|
do
|
||||||
|
across
|
||||||
|
a_container as i
|
||||||
|
loop
|
||||||
|
if
|
||||||
|
attached {WITH_CSS_ID} i.item as l_with_css_id and then
|
||||||
|
attached l_with_css_id.css_id as l_css_id and then
|
||||||
|
l_css_id.same_string_general (a_id)
|
||||||
|
then
|
||||||
|
if res = Void then
|
||||||
|
create res.make (1)
|
||||||
|
end
|
||||||
|
res.force (i.item)
|
||||||
|
elseif attached {ITERABLE [CMS_FORM_ITEM]} i.item as l_cont then
|
||||||
|
if attached items_by_css_id_from (l_cont, a_id) as lst then
|
||||||
|
if res = Void then
|
||||||
|
res := lst
|
||||||
|
else
|
||||||
|
res.append (lst)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
Result := res
|
||||||
|
end
|
||||||
|
|
||||||
feature -- Change
|
feature -- Change
|
||||||
|
|
||||||
extend (i: CMS_FORM_ITEM)
|
extend (i: CMS_FORM_ITEM)
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ inherit
|
|||||||
create
|
create
|
||||||
make,
|
make,
|
||||||
make_with_item,
|
make_with_item,
|
||||||
|
make_with_items,
|
||||||
make_with_text
|
make_with_text
|
||||||
|
|
||||||
feature {NONE} -- Initialization
|
feature {NONE} -- Initialization
|
||||||
@@ -38,6 +39,16 @@ feature {NONE} -- Initialization
|
|||||||
extend (i)
|
extend (i)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
make_with_items (it: ITERABLE [CMS_FORM_ITEM])
|
||||||
|
do
|
||||||
|
create items.make (2)
|
||||||
|
across
|
||||||
|
it as c
|
||||||
|
loop
|
||||||
|
extend (c.item)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
feature -- Access
|
feature -- Access
|
||||||
|
|
||||||
new_cursor: ITERATION_CURSOR [CMS_FORM_ITEM]
|
new_cursor: ITERATION_CURSOR [CMS_FORM_ITEM]
|
||||||
|
|||||||
@@ -51,6 +51,11 @@ feature -- Change
|
|||||||
items.force (i)
|
items.force (i)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
prepend (i: CMS_FORM_ITEM)
|
||||||
|
do
|
||||||
|
items.put_front (i)
|
||||||
|
end
|
||||||
|
|
||||||
extend_text (t: READABLE_STRING_8)
|
extend_text (t: READABLE_STRING_8)
|
||||||
do
|
do
|
||||||
items.force (create {CMS_FORM_RAW_TEXT}.make (t))
|
items.force (create {CMS_FORM_RAW_TEXT}.make (t))
|
||||||
|
|||||||
Reference in New Issue
Block a user