Moved more components from CMS to wsf_html.
This includes WSF_PAGER, and feature in WSF_THEME .. including WSF_API_OPTIONS used to compute url and link.
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
note
|
||||
description : "Objects that ..."
|
||||
author : "$Author$"
|
||||
description : "Objects that represent a form filled with data from request."
|
||||
date : "$Date$"
|
||||
revision : "$Revision$"
|
||||
|
||||
@@ -34,6 +33,9 @@ feature -- Status
|
||||
Result := errors = Void
|
||||
end
|
||||
|
||||
is_applied_to_associated_form: BOOLEAN
|
||||
-- Data already applied to `form'?
|
||||
|
||||
feature -- Access
|
||||
|
||||
item_same_string (a_name: READABLE_STRING_GENERAL; s: READABLE_STRING_GENERAL): BOOLEAN
|
||||
@@ -158,25 +160,28 @@ feature -- Basic operation
|
||||
|
||||
apply_to_associated_form
|
||||
do
|
||||
if attached errors as errs then
|
||||
across
|
||||
errs as e
|
||||
loop
|
||||
if attached e.item as err then
|
||||
if attached err.field as e_field then
|
||||
set_fields_invalid (True, e_field.name)
|
||||
if not is_applied_to_associated_form then
|
||||
if attached errors as errs then
|
||||
across
|
||||
errs as e
|
||||
loop
|
||||
if attached e.item as err then
|
||||
if attached err.field as e_field then
|
||||
set_fields_invalid (True, e_field.name)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
across
|
||||
items as c
|
||||
loop
|
||||
across
|
||||
form as i
|
||||
items as c
|
||||
loop
|
||||
apply_to_associated_form_item (c.key, c.item, i.item)
|
||||
across
|
||||
form as i
|
||||
loop
|
||||
apply_to_associated_form_item (c.key, c.item, i.item)
|
||||
end
|
||||
end
|
||||
is_applied_to_associated_form := True
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {WSF_THEME}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_THEME
|
||||
|
||||
feature -- Access
|
||||
|
||||
url_encoded (s: detachable READABLE_STRING_GENERAL): STRING_8
|
||||
local
|
||||
enc: URL_ENCODER
|
||||
do
|
||||
create enc
|
||||
if s /= Void then
|
||||
Result := enc.general_encoded_string (s)
|
||||
else
|
||||
create Result.make_empty
|
||||
end
|
||||
end
|
||||
|
||||
html_encoded (s: detachable READABLE_STRING_GENERAL): STRING_8
|
||||
local
|
||||
enc: HTML_ENCODER
|
||||
do
|
||||
create enc
|
||||
if s /= Void then
|
||||
Result := enc.general_encoded_string (s)
|
||||
else
|
||||
create Result.make_empty
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
@@ -1,109 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {WSF_WITH_CSS_CLASS}."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
WSF_WITH_CSS_CLASS
|
||||
|
||||
feature -- Status report
|
||||
|
||||
css_classes: detachable LIST [READABLE_STRING_8]
|
||||
|
||||
feature -- Change
|
||||
|
||||
reset_css_classes
|
||||
do
|
||||
css_classes := Void
|
||||
end
|
||||
|
||||
add_css_classes (a_classes: detachable ITERABLE [READABLE_STRING_8])
|
||||
do
|
||||
if a_classes /= Void then
|
||||
across
|
||||
a_classes as c
|
||||
loop
|
||||
add_css_class (c.item)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
add_css_class (a_class: READABLE_STRING_8)
|
||||
require
|
||||
is_valid_css_class: is_valid_css_class (a_class)
|
||||
local
|
||||
lst: like css_classes
|
||||
do
|
||||
lst := css_classes
|
||||
if lst = Void then
|
||||
create {ARRAYED_LIST [READABLE_STRING_8]} lst.make (1)
|
||||
lst.compare_objects
|
||||
css_classes := lst
|
||||
end
|
||||
lst.force (a_class)
|
||||
end
|
||||
|
||||
remove_css_class (a_class: READABLE_STRING_8)
|
||||
require
|
||||
is_valid_css_class: is_valid_css_class (a_class)
|
||||
local
|
||||
lst: like css_classes
|
||||
do
|
||||
lst := css_classes
|
||||
if lst /= Void then
|
||||
lst.prune_all (a_class)
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Query
|
||||
|
||||
is_valid_css_class (s: detachable READABLE_STRING_8): BOOLEAN
|
||||
do
|
||||
Result := s /= Void implies (not s.is_empty)
|
||||
-- To complete
|
||||
end
|
||||
|
||||
feature -- Conversion
|
||||
|
||||
append_css_class_to (a_target: STRING; a_additional_classes: detachable ITERABLE [READABLE_STRING_8])
|
||||
local
|
||||
f: BOOLEAN
|
||||
cl: READABLE_STRING_8
|
||||
do
|
||||
if css_classes /= Void or a_additional_classes /= Void then
|
||||
a_target.append (" class=%"")
|
||||
f := True -- is first
|
||||
|
||||
if attached css_classes as l_classes then
|
||||
across
|
||||
l_classes as c
|
||||
loop
|
||||
cl := c.item
|
||||
if not cl.is_empty then
|
||||
if f then
|
||||
f := False
|
||||
else
|
||||
a_target.append_character (' ')
|
||||
end
|
||||
a_target.append (cl)
|
||||
end
|
||||
end
|
||||
end
|
||||
if attached a_additional_classes as l_classes then
|
||||
across
|
||||
l_classes as c
|
||||
loop
|
||||
cl := c.item
|
||||
if not cl.is_empty then
|
||||
if not f then
|
||||
a_target.append_character (' ')
|
||||
end
|
||||
a_target.append (cl)
|
||||
end
|
||||
end
|
||||
end
|
||||
a_target.append_character ('%"')
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,41 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {WSF_WITH_CSS_ID}."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
WSF_WITH_CSS_ID
|
||||
|
||||
feature -- Status report
|
||||
|
||||
css_id: detachable READABLE_STRING_8
|
||||
|
||||
feature -- Change
|
||||
|
||||
set_css_id (a_id: like css_id)
|
||||
require
|
||||
is_valid_css_id: is_valid_css_id (a_id)
|
||||
do
|
||||
css_id := a_id
|
||||
end
|
||||
|
||||
feature -- Query
|
||||
|
||||
is_valid_css_id (s: detachable READABLE_STRING_8): BOOLEAN
|
||||
do
|
||||
Result := s /= Void implies (not s.is_empty)
|
||||
-- To complete
|
||||
end
|
||||
|
||||
feature -- Conversion
|
||||
|
||||
append_css_id_to (a_target: STRING)
|
||||
do
|
||||
if attached css_id as l_id then
|
||||
a_target.append (" id=%"")
|
||||
a_target.append (l_id)
|
||||
a_target.append_character ('%"')
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,43 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {WSF_WITH_CSS_STYLE}."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
WSF_WITH_CSS_STYLE
|
||||
|
||||
feature -- Status report
|
||||
|
||||
css_style: detachable CSS_STYLE
|
||||
|
||||
feature -- Change
|
||||
|
||||
reset_css_style
|
||||
do
|
||||
css_style := Void
|
||||
end
|
||||
|
||||
add_css_style (a_style: like css_style)
|
||||
local
|
||||
s: like css_style
|
||||
do
|
||||
s := css_style
|
||||
if s = Void then
|
||||
css_style := a_style
|
||||
elseif a_style /= Void then
|
||||
css_style := s + a_style
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Conversion
|
||||
|
||||
append_css_style_to (a_target: STRING)
|
||||
do
|
||||
if attached css_style as l_css_style then
|
||||
a_target.append (" style=%"")
|
||||
l_css_style.append_inline_to (a_target)
|
||||
a_target.append_character ('%"')
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,81 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {WSF_WITH_HTML_ATTRIBUTE}."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
WSF_WITH_HTML_ATTRIBUTE
|
||||
|
||||
feature -- Status report
|
||||
|
||||
html_attributes: detachable HASH_TABLE [detachable READABLE_STRING_8, STRING_8]
|
||||
|
||||
feature -- Change
|
||||
|
||||
reset_html_attributes
|
||||
do
|
||||
html_attributes := Void
|
||||
end
|
||||
|
||||
add_html_attribute (a_name: READABLE_STRING_8; a_value: detachable READABLE_STRING_8)
|
||||
require
|
||||
is_valid_attribute_name: is_valid_attribute_name (a_name)
|
||||
is_valid_attribute_value: is_valid_attribute_value (a_value)
|
||||
local
|
||||
lst: like html_attributes
|
||||
do
|
||||
lst := html_attributes
|
||||
if lst = Void then
|
||||
create lst.make (1)
|
||||
lst.compare_objects
|
||||
html_attributes := lst
|
||||
end
|
||||
lst.force (a_value, a_name)
|
||||
end
|
||||
|
||||
remove_html_attribute (a_name: READABLE_STRING_8)
|
||||
require
|
||||
is_valid_attribute_name: is_valid_attribute_name (a_name)
|
||||
local
|
||||
lst: like html_attributes
|
||||
do
|
||||
lst := html_attributes
|
||||
if lst /= Void then
|
||||
lst.remove (a_name)
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Query
|
||||
|
||||
is_valid_attribute_name (s: detachable READABLE_STRING_8): BOOLEAN
|
||||
do
|
||||
Result := s /= Void implies (not s.is_empty)
|
||||
-- To complete
|
||||
end
|
||||
|
||||
is_valid_attribute_value (s: detachable READABLE_STRING_8): BOOLEAN
|
||||
do
|
||||
Result := s /= Void implies (not s.has ('%"'))
|
||||
-- To complete
|
||||
end
|
||||
|
||||
feature -- Conversion
|
||||
|
||||
append_html_attributes_to (a_target: STRING)
|
||||
do
|
||||
if attached html_attributes as attribs then
|
||||
across
|
||||
attribs as c
|
||||
loop
|
||||
a_target.append (" " + c.key)
|
||||
if attached c.item as v then
|
||||
a_target.append_character ('=')
|
||||
a_target.append_character ('%"')
|
||||
a_target.append (v)
|
||||
a_target.append_character ('%"')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user