Completed a previous commit, especially to web form library (WSF_FORM).
Updated EiffelStudio wizard.
This commit is contained in:
@@ -20,6 +20,7 @@ port=9090
|
||||
### Secure connection settings
|
||||
# enable SSL, with file certificate.
|
||||
is_secure=true
|
||||
secure_port=9443
|
||||
secure_certificate=ca.crt
|
||||
secure_certificate_key=ca.key
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ feature -- Auth type
|
||||
|
||||
note
|
||||
copyright: "2011-2020, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||
revised_by: "Alexander Kogtenkov"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
|
||||
@@ -1,26 +1,31 @@
|
||||
note
|
||||
description: "Summary description for {WSF_APPLICATION_X_WWW_FORM_URLENCODED_HANDLER}."
|
||||
description: "Summary description for {WSF_MULTIPART_FORM_DATA_HANDLER}."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
WSF_APPLICATION_X_WWW_FORM_URLENCODED_HANDLER
|
||||
WSF_MULTIPART_FORM_DATA_HANDLER
|
||||
|
||||
inherit
|
||||
WSF_MIME_HANDLER
|
||||
|
||||
WSF_MIME_HANDLER_HELPER
|
||||
|
||||
WSF_VALUE_UTILITIES
|
||||
export
|
||||
{NONE} all
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
-- Instantiate Current
|
||||
do
|
||||
end
|
||||
|
||||
feature -- Status report
|
||||
|
||||
valid_content_type (a_content_type: HTTP_CONTENT_TYPE): BOOLEAN
|
||||
do
|
||||
Result := a_content_type.same_simple_type ({HTTP_MIME_TYPES}.application_x_www_form_encoded)
|
||||
Result := a_content_type.same_simple_type ({HTTP_MIME_TYPES}.multipart_form_data)
|
||||
end
|
||||
|
||||
feature -- Execution
|
||||
@@ -28,45 +33,232 @@ feature -- Execution
|
||||
handle (a_content_type: HTTP_CONTENT_TYPE; req: WSF_REQUEST;
|
||||
a_vars: HASH_TABLE [WSF_VALUE, READABLE_STRING_GENERAL]; a_raw_data: detachable CELL [detachable READABLE_STRING_8])
|
||||
local
|
||||
l_content: READABLE_STRING_8
|
||||
n, p, i, j: INTEGER
|
||||
s: READABLE_STRING_8
|
||||
l_name, l_value: READABLE_STRING_8
|
||||
do
|
||||
l_content := full_input_data (req)
|
||||
s := full_input_data (req)
|
||||
if a_raw_data /= Void then
|
||||
a_raw_data.replace (l_content)
|
||||
a_raw_data.replace (s)
|
||||
end
|
||||
check content_count_same_as_content_length_if_not_chunked: (not req.is_chunked_input) implies (l_content.count = req.content_length_value.to_integer_32) end --| FIXME: truncated value
|
||||
n := l_content.count
|
||||
if n > 0 then
|
||||
from
|
||||
p := 1
|
||||
until
|
||||
p = 0
|
||||
loop
|
||||
i := l_content.index_of ('&', p)
|
||||
if i = 0 then
|
||||
s := l_content.substring (p, n)
|
||||
p := 0
|
||||
--| FIXME: optimization ... fetch the input data progressively, otherwise we might run out of memory ...
|
||||
analyze_multipart_form (req, a_content_type, s, a_vars)
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation: Form analyzer
|
||||
|
||||
analyze_multipart_form (req: WSF_REQUEST; a_content_type: HTTP_CONTENT_TYPE; s: READABLE_STRING_8; vars: HASH_TABLE [WSF_VALUE, READABLE_STRING_GENERAL])
|
||||
-- Analyze multipart form content
|
||||
--| FIXME[2011-06-21]: integrate eMIME parser library
|
||||
require
|
||||
a_content_type_valid: a_content_type /= Void and not a_content_type.has_error
|
||||
s_attached: s /= Void
|
||||
same_content_length: req.content_length_value > 0 implies req.content_length_value.as_integer_32 <= s.count
|
||||
vars_attached: vars /= Void
|
||||
local
|
||||
p,i,next_b: INTEGER
|
||||
l_boundary_prefix: READABLE_STRING_8
|
||||
l_boundary_len: INTEGER
|
||||
l_boundary: detachable READABLE_STRING_8
|
||||
m: READABLE_STRING_8
|
||||
tmp: STRING_8
|
||||
is_crlf: BOOLEAN
|
||||
do
|
||||
l_boundary := a_content_type.parameter ("boundary")
|
||||
if l_boundary /= Void and then not l_boundary.is_empty then
|
||||
p := s.substring_index (l_boundary, 1)
|
||||
if p > 1 then
|
||||
l_boundary_prefix := s.substring (1, p - 1)
|
||||
l_boundary := l_boundary_prefix + l_boundary
|
||||
else
|
||||
s := l_content.substring (p, i - 1)
|
||||
p := i + 1
|
||||
l_boundary_prefix := ""
|
||||
end
|
||||
if not s.is_empty then
|
||||
j := s.index_of ('=', 1)
|
||||
if j > 0 then
|
||||
l_name := s.substring (1, j - 1)
|
||||
l_value := s.substring (j + 1, s.count)
|
||||
add_percent_encoded_string_value_to_table (l_name, l_value, a_vars)
|
||||
l_boundary_len := l_boundary.count
|
||||
--| Let's support either %R%N and %N ...
|
||||
--| Since both cases might occurs (for instance, our implementation of CGI does not have %R%N)
|
||||
--| then let's be as flexible as possible on this.
|
||||
is_crlf := s [l_boundary_len + 1] = '%R'
|
||||
from
|
||||
i := 1 + l_boundary_len + 1
|
||||
if is_crlf then
|
||||
i := i + 1 --| +1 = CR = %R
|
||||
end
|
||||
next_b := i
|
||||
until
|
||||
i = 0
|
||||
loop
|
||||
next_b := s.substring_index (l_boundary, i)
|
||||
if next_b > 0 then
|
||||
if is_crlf then
|
||||
m := s.substring (i, next_b - 1 - 2) --| 2 = CR LF = %R %N
|
||||
else
|
||||
m := s.substring (i, next_b - 1 - 1) --| 1 = LF = %N
|
||||
end
|
||||
analyze_multipart_form_input (req, m, vars)
|
||||
if s.valid_index (next_b + l_boundary_len + 1) then
|
||||
if is_crlf then
|
||||
if s[next_b + l_boundary_len] = '%R' and s[next_b + l_boundary_len + 1] = '%N' then
|
||||
-- continue
|
||||
else
|
||||
i := 0 -- reached the end
|
||||
end
|
||||
else
|
||||
if s[next_b + l_boundary_len + 1] = '%N' then
|
||||
-- continue
|
||||
else
|
||||
i := 0 -- reached the end
|
||||
end
|
||||
end
|
||||
else
|
||||
i := 0 -- missing end ?
|
||||
req.error_handler.add_custom_error (0, "Invalid form data", "Invalid ending for form data from input")
|
||||
end
|
||||
if i > 0 then
|
||||
i := next_b + l_boundary_len + 1
|
||||
if is_crlf then
|
||||
i := i + 1 --| +1 = CR = %R
|
||||
end
|
||||
end
|
||||
else
|
||||
if is_crlf then
|
||||
i := i + 1
|
||||
end
|
||||
tmp := s.substring (i - 1, s.count).to_string_8
|
||||
tmp.right_adjust
|
||||
-- TODO: check if next condition should not use tmp instead of s
|
||||
if i >= s.count and not l_boundary_prefix.same_string (tmp) then
|
||||
req.error_handler.add_custom_error (0, "Invalid form data", "Invalid ending for form data from input")
|
||||
end
|
||||
i := next_b
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
analyze_multipart_form_input (req: WSF_REQUEST; s: READABLE_STRING_8; vars: HASH_TABLE [WSF_VALUE, READABLE_STRING_GENERAL])
|
||||
-- Analyze multipart entry
|
||||
require
|
||||
s_not_empty: s /= Void and then not s.is_empty
|
||||
local
|
||||
n, i,p, b,e: INTEGER
|
||||
l_name, l_filename, l_content_type: detachable READABLE_STRING_8
|
||||
l_unicode_name: READABLE_STRING_32
|
||||
l_header: detachable READABLE_STRING_8
|
||||
l_content: detachable READABLE_STRING_8
|
||||
l_line: detachable READABLE_STRING_8
|
||||
l_up_file: WSF_UPLOADED_FILE
|
||||
utf: UTF_CONVERTER
|
||||
do
|
||||
from
|
||||
p := 1
|
||||
n := s.count
|
||||
until
|
||||
p > n or l_header /= Void
|
||||
loop
|
||||
inspect s[p]
|
||||
when '%R' then -- CR
|
||||
if
|
||||
n >= p + 3 and then
|
||||
s[p+1] = '%N' and then -- LF
|
||||
s[p+2] = '%R' and then -- CR
|
||||
s[p+3] = '%N' -- LF
|
||||
then
|
||||
l_header := s.substring (1, p + 1)
|
||||
l_content := s.substring (p + 4, n)
|
||||
end
|
||||
when '%N' then
|
||||
if
|
||||
n >= p + 1 and then
|
||||
s[p+1] = '%N'
|
||||
then
|
||||
l_header := s.substring (1, p)
|
||||
l_content := s.substring (p + 2, n)
|
||||
end
|
||||
else
|
||||
end
|
||||
p := p + 1
|
||||
end
|
||||
if l_header /= Void and l_content /= Void then
|
||||
from
|
||||
i := 1
|
||||
n := l_header.count
|
||||
until
|
||||
i = 0 or i > n
|
||||
loop
|
||||
l_line := Void
|
||||
b := i
|
||||
p := l_header.index_of ('%N', b)
|
||||
if p > 0 then
|
||||
if l_header[p - 1] = '%R' then
|
||||
p := p - 1
|
||||
i := p + 2
|
||||
else
|
||||
i := p + 1
|
||||
end
|
||||
end
|
||||
if p > 0 then
|
||||
l_line := l_header.substring (b, p - 1)
|
||||
if l_line.starts_with ("Content-Disposition: form-data") then
|
||||
p := l_line.substring_index ("name=", 1)
|
||||
if p > 0 then
|
||||
p := p + 4 --| 4 = ("name=").count - 1
|
||||
if l_line.valid_index (p+1) and then l_line[p+1] = '%"' then
|
||||
p := p + 1
|
||||
e := l_line.index_of ('"', p + 1)
|
||||
else
|
||||
e := l_line.index_of (';', p + 1)
|
||||
if e = 0 then
|
||||
e := l_line.count
|
||||
end
|
||||
end
|
||||
l_name := l_header.substring (p + 1, e - 1)
|
||||
end
|
||||
|
||||
p := l_line.substring_index ("filename=", 1)
|
||||
if p > 0 then
|
||||
p := p + 8 --| 8 = ("filename=").count - 1
|
||||
if l_line.valid_index (p+1) and then l_line[p+1] = '%"' then
|
||||
p := p + 1
|
||||
e := l_line.index_of ('"', p + 1)
|
||||
else
|
||||
e := l_line.index_of (';', p + 1)
|
||||
if e = 0 then
|
||||
e := l_line.count
|
||||
end
|
||||
end
|
||||
l_filename := l_header.substring (p + 1, e - 1)
|
||||
end
|
||||
elseif l_line.starts_with ("Content-Type: ") then
|
||||
l_content_type := l_line.substring (15, l_line.count)
|
||||
end
|
||||
else
|
||||
i := 0
|
||||
end
|
||||
end
|
||||
if l_name /= Void then
|
||||
if l_filename /= Void and then not l_filename.is_empty then
|
||||
if l_content_type = Void then
|
||||
l_content_type := default_content_type
|
||||
end
|
||||
l_unicode_name := utf.utf_8_string_8_to_string_32 (l_name)
|
||||
create l_up_file.make (l_unicode_name, utf.utf_8_string_8_to_escaped_string_32 (l_filename), l_content_type, l_content.count)
|
||||
add_value_to_table (l_unicode_name, l_up_file, vars)
|
||||
--| `l_up_file' might have a new name
|
||||
req.save_uploaded_file (l_up_file, l_content)
|
||||
else
|
||||
add_utf_8_string_value_to_table (l_name, l_content, vars)
|
||||
end
|
||||
else
|
||||
req.error_handler.add_custom_error (0, "unamed multipart entry", Void)
|
||||
end
|
||||
else
|
||||
req.error_handler.add_custom_error (0, "missformed multipart entry", Void)
|
||||
end
|
||||
end
|
||||
|
||||
default_content_type: STRING = "text/plain"
|
||||
-- Default content type
|
||||
|
||||
note
|
||||
copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Colin Adams, Eiffel Software and others"
|
||||
copyright: "2011-2020, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Colin Adams, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
|
||||
@@ -18,7 +18,7 @@ feature -- Core
|
||||
deferred
|
||||
end
|
||||
|
||||
based_path (p: STRING): STRING
|
||||
based_path (p: READABLE_STRING_8): STRING
|
||||
-- Path `p' in the context of the `base_url'
|
||||
do
|
||||
if attached base_url as l_base_url then
|
||||
@@ -32,7 +32,7 @@ feature -- Core
|
||||
end
|
||||
end
|
||||
else
|
||||
Result := p
|
||||
Result := p.to_string_8
|
||||
end
|
||||
end
|
||||
|
||||
@@ -106,7 +106,8 @@ feature -- Conversion
|
||||
|
||||
url (a_path: READABLE_STRING_8; opts: detachable WSF_API_OPTIONS): STRING
|
||||
local
|
||||
q,f: detachable STRING_8
|
||||
q: detachable STRING_8
|
||||
f: detachable READABLE_STRING_8
|
||||
l_abs: BOOLEAN
|
||||
do
|
||||
l_abs := False
|
||||
@@ -115,7 +116,7 @@ feature -- Conversion
|
||||
l_abs := opts.boolean_item ("absolute", l_abs)
|
||||
if attached opts.item ("query") as l_query then
|
||||
if attached {READABLE_STRING_8} l_query as s_value then
|
||||
q := s_value
|
||||
q := s_value.to_string_8
|
||||
elseif attached {ITERABLE [TUPLE [key, value: READABLE_STRING_GENERAL]]} l_query as lst then
|
||||
create q.make_empty
|
||||
across
|
||||
@@ -154,16 +155,18 @@ feature -- Conversion
|
||||
end
|
||||
end
|
||||
else
|
||||
Result := a_path
|
||||
Result := a_path.to_string_8
|
||||
end
|
||||
else
|
||||
Result := based_path (a_path)
|
||||
end
|
||||
if q /= Void then
|
||||
Result.append ("?" + q)
|
||||
Result.append_character ('?')
|
||||
Result.append (q)
|
||||
end
|
||||
if f /= Void then
|
||||
Result.append ("#" + f)
|
||||
Result.append_character ('#')
|
||||
Result.append (f)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -26,6 +26,31 @@ feature -- Access
|
||||
|
||||
input_type: STRING = "date"
|
||||
|
||||
feature -- Element change
|
||||
|
||||
set_date_value (dt: DATE)
|
||||
-- Set value using date `dt`.
|
||||
local
|
||||
y,m,d: INTEGER
|
||||
s: STRING
|
||||
do
|
||||
y := dt.year
|
||||
m := dt.month
|
||||
d := dt.day
|
||||
create s.make (10)
|
||||
s.append_integer (y)
|
||||
s.append_character ('-')
|
||||
if m <= 9 then
|
||||
s.append_character ('0')
|
||||
end
|
||||
s.append_integer (m)
|
||||
s.append_character ('-')
|
||||
if d <= 9 then
|
||||
s.append_character ('0')
|
||||
end
|
||||
s.append_integer (d)
|
||||
set_text_value (s)
|
||||
end
|
||||
|
||||
feature {NONE} -- Conversion
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ inherit
|
||||
redefine
|
||||
set_value,
|
||||
specific_input_attributes_string,
|
||||
append_child_to_html
|
||||
append_item_to_html
|
||||
end
|
||||
|
||||
WSF_FORM_SELECTABLE_ITEM
|
||||
@@ -97,14 +97,30 @@ feature -- Change
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
append_child_to_html (a_theme: WSF_THEME; a_html: STRING_8)
|
||||
-- Specific child element if any.
|
||||
--| To redefine if needed
|
||||
append_item_to_html (a_theme: WSF_THEME; a_html: STRING_8)
|
||||
do
|
||||
Precursor (a_theme, a_html)
|
||||
append_label_to_html (a_theme, a_html)
|
||||
end
|
||||
|
||||
append_label_to_html (a_theme: WSF_THEME; a_html: STRING_8)
|
||||
-- Specific label element if any.
|
||||
local
|
||||
s: READABLE_STRING_8
|
||||
do
|
||||
if attached raw_title as t then
|
||||
a_html.append (t)
|
||||
s := t
|
||||
elseif attached title as t then
|
||||
a_html.append (a_theme.html_encoded (t))
|
||||
s := a_theme.html_encoded (t)
|
||||
end
|
||||
if s /= Void then
|
||||
if attached css_id as l_id then
|
||||
a_html.append ("<label for=%""+ l_id +"%">")
|
||||
else
|
||||
a_html.append ("<label>")
|
||||
end
|
||||
a_html.append (s)
|
||||
a_html.append ("</label>")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -109,6 +109,7 @@ feature -- Conversion
|
||||
local
|
||||
l_is_already_selected: BOOLEAN
|
||||
h: detachable STRING_8
|
||||
l_item_html_text: READABLE_STRING_8
|
||||
do
|
||||
a_html.append ("<select name=%""+ name +"%" ")
|
||||
if css_id = Void then
|
||||
@@ -128,7 +129,7 @@ feature -- Conversion
|
||||
across
|
||||
options as o
|
||||
loop
|
||||
a_html.append ("<option value=%"" + o.item.value + "%" ")
|
||||
a_html.append ("<option value=%"" + html_encoded_string (o.item.value) + "%" ")
|
||||
-- if not l_is_already_selected then
|
||||
if
|
||||
o.item.is_selected
|
||||
@@ -137,12 +138,13 @@ feature -- Conversion
|
||||
a_html.append (" selected=%"selected%"")
|
||||
end
|
||||
-- end
|
||||
a_html.append (">" + o.item.text + "</option>%N")
|
||||
l_item_html_text := html_encoded_string (o.item.text)
|
||||
a_html.append (">" + l_item_html_text + "</option>%N")
|
||||
if attached o.item.description as d then
|
||||
if h = Void then
|
||||
create h.make_empty
|
||||
end
|
||||
h.append ("<div id=%"" + name + "-" + o.item.value + "%" class=%"option%"><strong>"+ o.item.text +"</strong>:"+ d + "</div>")
|
||||
h.append ("<div id=%"" + name + "-" + html_encoded_string (o.item.value) + "%" class=%"option%"><strong>"+ l_item_html_text +"</strong>:"+ d + "</div>")
|
||||
end
|
||||
end
|
||||
a_html.append ("</select>%N")
|
||||
|
||||
@@ -17,14 +17,14 @@ create
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_value: READABLE_STRING_GENERAL; a_text: detachable like text)
|
||||
make (a_value: READABLE_STRING_GENERAL; a_text: detachable READABLE_STRING_GENERAL)
|
||||
-- Initialize `Current'.
|
||||
do
|
||||
value := a_value.as_string_32
|
||||
if a_text = Void then
|
||||
text := html_encoder.general_encoded_string (a_value)
|
||||
else
|
||||
text := a_text
|
||||
text := a_text.to_string_32
|
||||
end
|
||||
end
|
||||
|
||||
@@ -37,16 +37,16 @@ feature -- Status
|
||||
Result := value.same_string_general (v)
|
||||
end
|
||||
|
||||
is_same_text (v: like text): BOOLEAN
|
||||
is_same_text (v: READABLE_STRING_GENERAL): BOOLEAN
|
||||
do
|
||||
Result := text.same_string (v)
|
||||
Result := v.same_string (text)
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
value: READABLE_STRING_32
|
||||
|
||||
text: READABLE_STRING_8
|
||||
text: READABLE_STRING_32
|
||||
|
||||
description: detachable READABLE_STRING_8
|
||||
|
||||
|
||||
@@ -42,6 +42,20 @@ feature -- Change
|
||||
Precursor (i)
|
||||
end
|
||||
|
||||
set_field_text_value (a_name: READABLE_STRING_GENERAL; a_text_value: detachable READABLE_STRING_GENERAL)
|
||||
-- Set recursively text value of input fields named `a_name` to value `a_text_value`.
|
||||
do
|
||||
across
|
||||
items as ic
|
||||
loop
|
||||
if attached {WSF_FORM_INPUT} ic.item as l_input and then l_input.name.same_string_general (a_name) then
|
||||
l_input.set_text_value (a_text_value)
|
||||
elseif attached {WSF_FORM_COMPOSITE} ic.item as l_composite then
|
||||
l_composite.set_field_text_value (a_name, a_text_value)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation: Items
|
||||
|
||||
container_has_field (a_container: ITERABLE [WSF_WIDGET]; a_name: READABLE_STRING_GENERAL): BOOLEAN
|
||||
|
||||
@@ -62,14 +62,16 @@ feature -- Access
|
||||
|
||||
table_item (a_name: READABLE_STRING_GENERAL): detachable WSF_TABLE
|
||||
local
|
||||
s,k: READABLE_STRING_GENERAL
|
||||
s: STRING_32
|
||||
k: READABLE_STRING_GENERAL
|
||||
p,q: INTEGER
|
||||
do
|
||||
if attached {WSF_TABLE} item (a_name) as tb then
|
||||
Result := tb
|
||||
else
|
||||
s := a_name + "["
|
||||
create Result.make (a_name.to_string_8) -- FIXME
|
||||
create s.make_from_string_general (a_name)
|
||||
s.append_character ('[')
|
||||
create Result.make (a_name)
|
||||
across
|
||||
items as c
|
||||
loop
|
||||
|
||||
@@ -35,7 +35,10 @@ feature -- Status report
|
||||
debug_output: STRING
|
||||
-- String that should be displayed in debugger to represent `Current'.
|
||||
do
|
||||
Result := name + " {" + generator + "}"
|
||||
create Result.make_from_string (name)
|
||||
Result.append (" {")
|
||||
Result.append (generator)
|
||||
Result.append_character ('}')
|
||||
end
|
||||
|
||||
feature -- Validation
|
||||
|
||||
@@ -58,9 +58,9 @@ feature -- Element Change
|
||||
is_valid_number: a_val.is_integer
|
||||
do
|
||||
if a_val.is_string_32 then
|
||||
min := html_encoder.encoded_string (a_val.as_string_32)
|
||||
min := html_encoder.encoded_string (a_val.to_string_32)
|
||||
elseif a_val.is_string_8 then
|
||||
min := a_val.as_string_8
|
||||
min := a_val.to_string_8
|
||||
end
|
||||
ensure
|
||||
min_set: attached min as l_min implies l_min.same_string_general (a_val)
|
||||
@@ -72,9 +72,9 @@ feature -- Element Change
|
||||
is_valid_number: a_val.is_integer
|
||||
do
|
||||
if a_val.is_string_32 then
|
||||
max := html_encoder.encoded_string (a_val.as_string_32)
|
||||
max := html_encoder.encoded_string (a_val.to_string_32)
|
||||
elseif a_val.is_string_8 then
|
||||
max := a_val.as_string_8
|
||||
max := a_val.to_string_8
|
||||
end
|
||||
ensure
|
||||
max_set: attached max as l_max implies l_max.same_string_general (a_val)
|
||||
@@ -86,9 +86,9 @@ feature -- Element Change
|
||||
is_valid_sequence: a_val.is_number_sequence or else a_val.is_real_sequence
|
||||
do
|
||||
if a_val.is_string_32 then
|
||||
step := html_encoder.encoded_string (a_val.as_string_32)
|
||||
step := html_encoder.encoded_string (a_val.to_string_32)
|
||||
elseif a_val.is_string_8 then
|
||||
step := a_val.as_string_8
|
||||
step := a_val.to_string_8
|
||||
end
|
||||
ensure
|
||||
step_set: attached step as l_step implies l_step.same_string_general (a_val)
|
||||
|
||||
@@ -9,7 +9,7 @@ class
|
||||
|
||||
feature -- Converter
|
||||
|
||||
html_encoded_string (s: READABLE_STRING_GENERAL): READABLE_STRING_8
|
||||
html_encoded_string (s: READABLE_STRING_GENERAL): STRING_8
|
||||
do
|
||||
Result := html_encoder.general_encoded_string (s)
|
||||
end
|
||||
|
||||
@@ -166,6 +166,19 @@ feature -- Change
|
||||
end
|
||||
end
|
||||
|
||||
remove (i: WSF_WIDGET)
|
||||
-- Remove widget `i` from Current, recursively.
|
||||
do
|
||||
items.prune_all (i)
|
||||
across
|
||||
items as ic
|
||||
loop
|
||||
if attached {WSF_WIDGET_COMPOSITE} ic.item as l_comp then
|
||||
l_comp.remove (i)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
extend (i: WSF_WIDGET)
|
||||
do
|
||||
items.force (i)
|
||||
|
||||
@@ -30,7 +30,7 @@ feature -- Change
|
||||
lst.compare_objects
|
||||
html_attributes := lst
|
||||
end
|
||||
lst.force (a_value, a_name)
|
||||
lst.force (a_value, a_name.to_string_8)
|
||||
end
|
||||
|
||||
remove_html_attribute (a_name: READABLE_STRING_8)
|
||||
@@ -41,7 +41,7 @@ feature -- Change
|
||||
do
|
||||
lst := html_attributes
|
||||
if lst /= Void then
|
||||
lst.remove (a_name)
|
||||
lst.remove (a_name.to_string_8)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
</file_rule>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
|
||||
<library name="encoder" location="..\..\text\encoder\encoder.ecf"/>
|
||||
<library name="uri_template" location="..\..\text\parser\uri_template\uri_template.ecf"/>
|
||||
<library name="time" location="$ISE_LIBRARY\library\time\time.ecf"/>
|
||||
<library name="uri_template" location="..\..\text\parser\uri_template\uri_template.ecf"/>
|
||||
<library name="wsf" location="..\wsf\wsf.ecf"/>
|
||||
<cluster name="api" location=".\api\" recursive="true"/>
|
||||
<cluster name="css" location=".\css\" recursive="true"/>
|
||||
|
||||
@@ -7,7 +7,10 @@
|
||||
<exclude>/\.git$</exclude>
|
||||
<exclude>/\.svn$</exclude>
|
||||
</file_rule>
|
||||
<option warning="true">
|
||||
</option>
|
||||
<setting name="console_application" value="true"/>
|
||||
<setting name="dead_code_removal" value="all"/>
|
||||
<capability>
|
||||
<concurrency support="none" use="none"/>
|
||||
</capability>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
note
|
||||
description: "Console wizard."
|
||||
author: "$Author$"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
@@ -301,7 +301,7 @@ feature {NONE} -- Implementation
|
||||
if
|
||||
a_required_valid_option and then
|
||||
a_options /= Void and then
|
||||
not across a_options as o some attached o.item.value as v and then Result.same_string (v) end
|
||||
not across a_options as o some attached o.item.value as v and then Result.same_string_general (v) end
|
||||
then
|
||||
l_answered := False
|
||||
Result := Void
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
note
|
||||
description: "Summary description for {CONSOLE_WIZARD_PAGE}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
@@ -13,7 +11,7 @@ inherit
|
||||
create
|
||||
make
|
||||
|
||||
feature {WIZARD, WIZARD_ENGINE, WIZARD_PAGE} -- Implementation
|
||||
feature {WIZARD, WIZARD_PAGE} -- Implementation
|
||||
|
||||
reuse
|
||||
do
|
||||
|
||||
@@ -33,6 +33,7 @@ feature {NONE} -- Initialization
|
||||
if s.same_string_general ("-callback") or s.same_string_general ("--callback") then
|
||||
i := i + 1
|
||||
if i <= n then
|
||||
s := args.argument (i)
|
||||
create callback_file_name.make_from_string (s)
|
||||
end
|
||||
elseif wizard_directory_name = Void then
|
||||
@@ -114,14 +115,15 @@ feature -- Helpers
|
||||
Result := a_folder.extended (a_name)
|
||||
ok := not ut.directory_path_exists (Result)
|
||||
p := Result
|
||||
if not ok then
|
||||
if attached p.extension as ext then
|
||||
if
|
||||
not ok and then
|
||||
attached p.extension as ext
|
||||
then
|
||||
l_ext := ext
|
||||
l_name := p.name
|
||||
l_name.remove_head (ext.count + 1)
|
||||
create p.make_from_string (l_name)
|
||||
end
|
||||
end
|
||||
until
|
||||
ok
|
||||
loop
|
||||
|
||||
@@ -51,11 +51,8 @@ feature -- Response
|
||||
feature -- Factory
|
||||
|
||||
new_uuid: STRING_8
|
||||
local
|
||||
gen: UUID_GENERATOR
|
||||
do
|
||||
create gen
|
||||
Result := gen.generate_uuid.out
|
||||
Result := {UUID_GENERATOR}.generate_uuid.out
|
||||
end
|
||||
|
||||
feature -- Operations
|
||||
@@ -98,19 +95,17 @@ feature -- Templates
|
||||
|
||||
recursive_copy_templates (a_src: PATH; a_target: PATH)
|
||||
local
|
||||
d,td, subdir: DIRECTORY
|
||||
d, subdir: DIRECTORY
|
||||
p, ip, tp: PATH
|
||||
do
|
||||
create d.make_with_path (a_src)
|
||||
if d.exists and then d.is_readable then
|
||||
create td.make_with_path (a_target)
|
||||
td.recursive_create_dir
|
||||
;(create {DIRECTORY}.make_with_path (a_target)).recursive_create_dir
|
||||
across
|
||||
d.entries as ic
|
||||
loop
|
||||
p := ic.item
|
||||
if p.is_parent_symbol or p.is_current_symbol then
|
||||
else
|
||||
if not p.is_parent_symbol and not p.is_current_symbol then
|
||||
ip := a_src.extended_path (p)
|
||||
create subdir.make_with_path (ip)
|
||||
tp := a_target.extended_path (resolved_path_name (p))
|
||||
@@ -133,7 +128,6 @@ feature -- Templates
|
||||
a_src_is_a_template_file: is_template_file (a_src)
|
||||
local
|
||||
f,t: PLAIN_TEXT_FILE
|
||||
line: READABLE_STRING_8
|
||||
do
|
||||
create f.make_with_path (a_src)
|
||||
if f.exists and f.is_readable then
|
||||
@@ -146,8 +140,7 @@ feature -- Templates
|
||||
until
|
||||
f.exhausted
|
||||
loop
|
||||
line := f.last_string
|
||||
t.put_string (resolved_string_8 (line))
|
||||
t.put_string (resolved_string_8 (f.last_string))
|
||||
t.put_new_line
|
||||
f.read_line
|
||||
end
|
||||
@@ -177,7 +170,6 @@ feature -- Resolvers
|
||||
from
|
||||
i := 1
|
||||
n := s.count
|
||||
q := 0
|
||||
until
|
||||
i > n
|
||||
loop
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
note
|
||||
description : "Objects that ..."
|
||||
author: "$Author$"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
@@ -53,8 +52,6 @@ feature {NONE} -- Widget
|
||||
feature -- Factory
|
||||
|
||||
new_page (a_page_id: READABLE_STRING_8): GRAPHICAL_WIZARD_PAGE
|
||||
local
|
||||
lab: EV_LABEL
|
||||
do
|
||||
create Result.make (a_page_id)
|
||||
end
|
||||
@@ -89,7 +86,6 @@ feature {NONE} -- Implementation: UI
|
||||
hb,hb2: EV_HORIZONTAL_BOX
|
||||
mb, vb, headerb: EV_VERTICAL_BOX
|
||||
lab: EV_LABEL
|
||||
but: EV_BUTTON
|
||||
cl: EV_CELL
|
||||
fr: detachable EV_FRAME
|
||||
do
|
||||
@@ -182,7 +178,6 @@ feature {NONE} -- Implementation: UI
|
||||
|
||||
mb.extend (fr)
|
||||
mb.disable_item_expand (fr)
|
||||
fr := Void
|
||||
end
|
||||
|
||||
-- ./Text part
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
note
|
||||
description: "Summary description for {GRAPHICAL_WIZARD_PAGE}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
@@ -20,7 +18,7 @@ inherit
|
||||
create
|
||||
make
|
||||
|
||||
feature {WIZARD, WIZARD_ENGINE, WIZARD_PAGE} -- Implementation
|
||||
feature {WIZARD, WIZARD_PAGE} -- Implementation
|
||||
|
||||
reuse
|
||||
do
|
||||
@@ -95,11 +93,12 @@ feature {NONE} -- Implementation
|
||||
|
||||
unparent (i: WIZARD_PAGE_ITEM)
|
||||
do
|
||||
if attached {GRAPHICAL_WIZARD_PAGE_ITEM} i as gpi then
|
||||
if attached gpi.widget.parent as l_parent then
|
||||
if
|
||||
attached {GRAPHICAL_WIZARD_PAGE_ITEM} i as gpi and then
|
||||
attached gpi.widget.parent as l_parent
|
||||
then
|
||||
l_parent.prune (gpi.widget)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
note
|
||||
description: "Summary description for {GRAPHICAL_WIZARD_STYLER}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
@@ -42,9 +40,7 @@ feature -- Style
|
||||
lab.align_text_top
|
||||
end
|
||||
end
|
||||
if attached {EV_COLORIZABLE} w as l_colorizable then
|
||||
l_colorizable.set_foreground_color (colors.black)
|
||||
end
|
||||
w.set_foreground_color (colors.black)
|
||||
if attached {EV_FONTABLE} w as l_fontable then
|
||||
l_fontable.set_font (text_font)
|
||||
end
|
||||
@@ -82,9 +78,7 @@ feature -- Style
|
||||
apply_field_description_style (w: EV_WIDGET)
|
||||
do
|
||||
apply_text_style (w)
|
||||
if attached {EV_COLORIZABLE} w as l_colorizable then
|
||||
l_colorizable.set_foreground_color (colors.dark_gray)
|
||||
end
|
||||
w.set_foreground_color (colors.dark_gray)
|
||||
if attached {EV_FONTABLE} w as l_fontable then
|
||||
l_fontable.set_font (field_description_font)
|
||||
end
|
||||
|
||||
@@ -66,7 +66,7 @@ feature -- Conversion
|
||||
|
||||
text: STRING_32
|
||||
do
|
||||
Result := input_widget.text
|
||||
Result := input_widget.file_path.name
|
||||
end
|
||||
|
||||
value: detachable PATH
|
||||
@@ -92,11 +92,7 @@ feature -- Element change
|
||||
|
||||
set_value (p: like value)
|
||||
do
|
||||
if p = Void then
|
||||
input_widget.set_text ("")
|
||||
else
|
||||
input_widget.set_text (p.name)
|
||||
end
|
||||
input_widget.set_file_path (if attached p then p else create {PATH}.make_empty end)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
note
|
||||
description: "Summary description for {GRAPHICAL_WIZARD_INTEGER_QUESTION}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
@@ -94,8 +92,6 @@ feature -- Element change
|
||||
set_value (0)
|
||||
elseif t.is_integer then
|
||||
set_value (t.to_integer)
|
||||
else
|
||||
-- ignore !
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
note
|
||||
description: "Summary description for {GRAPHICAL_WIZARD_QUESTION}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
@@ -41,7 +39,6 @@ feature {NONE} -- Implementation
|
||||
|
||||
append_indented_widget (w: EV_WIDGET; a_container: EV_BOX)
|
||||
local
|
||||
lab: EV_LABEL
|
||||
hb: EV_HORIZONTAL_BOX
|
||||
do
|
||||
create hb
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-16-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-16-0 http://www.eiffel.com/developers/xml/configuration-1-16-0.xsd" name="{$WIZ.project.name/}" uuid="{$UUID/}">
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-18-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-18-0 http://www.eiffel.com/developers/xml/configuration-1-18-0.xsd" name="{$WIZ.project.name/}" uuid="{$UUID/}">
|
||||
<target name="common" abstract="true">
|
||||
<file_rule>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
@@ -9,15 +9,15 @@
|
||||
<option warning="true">
|
||||
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
|
||||
</option>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||
<library name="http" location="$ISE_LIBRARY\contrib\library\network\protocol\http\http-safe.ecf"/>
|
||||
<library name="wsf" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf-safe.ecf"/>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
|
||||
<library name="http" location="$ISE_LIBRARY\contrib\library\network\protocol\http\http.ecf"/>
|
||||
<library name="wsf" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf.ecf"/>
|
||||
</target>
|
||||
<target name="{$WIZ.project.name/}_any" extends="common">
|
||||
<root class="{$APP_ROOT/}" feature="make_and_launch"/>
|
||||
{if condition="$WIZ.connectors.use_standalone ~ $WIZ_YES"}<library name="standalone" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\connector\standalone-safe.ecf"/>{/if}
|
||||
{if condition="$WIZ.connectors.use_cgi ~ $WIZ_YES"}<library name="cgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\connector\cgi-safe.ecf"/>{/if}
|
||||
{if condition="$WIZ.connectors.use_libfcgi ~ $WIZ_YES"}<library name="libfcgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\connector\libfcgi-safe.ecf"/>{/if}
|
||||
{if condition="$WIZ.connectors.use_standalone ~ $WIZ_YES"}<library name="standalone" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\connector\standalone.ecf"/>{/if}
|
||||
{if condition="$WIZ.connectors.use_cgi ~ $WIZ_YES"}<library name="cgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\connector\cgi.ecf"/>{/if}
|
||||
{if condition="$WIZ.connectors.use_libfcgi ~ $WIZ_YES"}<library name="libfcgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\connector\libfcgi.ecf"/>{/if}
|
||||
<cluster name="launcher" location=".\launcher\">
|
||||
<cluster name="any_launcher" location="$|any"/>
|
||||
</cluster>
|
||||
@@ -27,7 +27,7 @@
|
||||
<target name="{$WIZ.project.name/}_standalone" extends="common">
|
||||
<root class="{$APP_ROOT/}" feature="make_and_launch"/>
|
||||
<variable name="httpd_ssl_disabled" value="true"/><!-- for now ... due to issue with libcurl+eiffelnet ssl -->
|
||||
<library name="default_standalone" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\default\standalone-safe.ecf"/>
|
||||
<library name="default_standalone" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\default\standalone.ecf"/>
|
||||
<cluster name="launcher" location=".\launcher\">
|
||||
<cluster name="default_launcher" location="$|default"/>
|
||||
</cluster>
|
||||
@@ -39,7 +39,7 @@
|
||||
<capability>
|
||||
<concurrency use="none" />
|
||||
</capability>
|
||||
<library name="default_cgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\default\cgi-safe.ecf"/>
|
||||
<library name="default_cgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\default\cgi.ecf"/>
|
||||
<cluster name="launcher" location=".\launcher\">
|
||||
<cluster name="default_launcher" location="$|default"/>
|
||||
</cluster>
|
||||
@@ -51,7 +51,7 @@
|
||||
<capability>
|
||||
<concurrency use="none" />
|
||||
</capability>
|
||||
<library name="default_libfcgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\default\libfcgi-safe.ecf"/>
|
||||
<library name="default_libfcgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\default\libfcgi.ecf"/>
|
||||
<cluster name="launcher" location=".\launcher\">
|
||||
<cluster name="default_launcher" location="$|default"/>
|
||||
</cluster>
|
||||
|
||||
Reference in New Issue
Block a user