Updated CMS support for unicode.
This commit is contained in:
@@ -20,8 +20,8 @@ feature {NONE} -- Initialization
|
|||||||
|
|
||||||
initialize
|
initialize
|
||||||
local
|
local
|
||||||
args: ARGUMENTS
|
args: ARGUMENTS_32
|
||||||
cfg: detachable STRING
|
cfg: detachable READABLE_STRING_32
|
||||||
i,n: INTEGER
|
i,n: INTEGER
|
||||||
do
|
do
|
||||||
--| Arguments
|
--| Arguments
|
||||||
@@ -33,7 +33,7 @@ feature {NONE} -- Initialization
|
|||||||
i > n or cfg /= Void
|
i > n or cfg /= Void
|
||||||
loop
|
loop
|
||||||
if attached args.argument (i) as s then
|
if attached args.argument (i) as s then
|
||||||
if s.same_string ("--config") or s.same_string ("-c") then
|
if s.same_string_general ("--config") or s.same_string_general ("-c") then
|
||||||
if i < n then
|
if i < n then
|
||||||
cfg := args.argument (i + 1)
|
cfg := args.argument (i + 1)
|
||||||
end
|
end
|
||||||
@@ -43,7 +43,7 @@ feature {NONE} -- Initialization
|
|||||||
end
|
end
|
||||||
if cfg = Void then
|
if cfg = Void then
|
||||||
if file_exists ("cms.ini") then
|
if file_exists ("cms.ini") then
|
||||||
cfg := "cms.ini"
|
cfg := {STRING_32} "cms.ini"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ feature {NONE} -- Initialization
|
|||||||
launch_cms (cms_setup (cfg))
|
launch_cms (cms_setup (cfg))
|
||||||
end
|
end
|
||||||
|
|
||||||
cms_setup (a_cfg_fn: detachable READABLE_STRING_8): CMS_CUSTOM_SETUP
|
cms_setup (a_cfg_fn: detachable READABLE_STRING_GENERAL): CMS_CUSTOM_SETUP
|
||||||
do
|
do
|
||||||
if a_cfg_fn /= Void then
|
if a_cfg_fn /= Void then
|
||||||
create Result.make_from_file (a_cfg_fn)
|
create Result.make_from_file (a_cfg_fn)
|
||||||
@@ -124,11 +124,11 @@ feature -- Event
|
|||||||
|
|
||||||
feature -- Helper
|
feature -- Helper
|
||||||
|
|
||||||
file_exists (fn: STRING): BOOLEAN
|
file_exists (fn: READABLE_STRING_GENERAL): BOOLEAN
|
||||||
local
|
local
|
||||||
f: RAW_FILE
|
f: RAW_FILE
|
||||||
do
|
do
|
||||||
create f.make (fn)
|
create f.make_with_name (fn)
|
||||||
Result := f.exists and then f.is_readable
|
Result := f.exists and then f.is_readable
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,14 @@ note
|
|||||||
class
|
class
|
||||||
CMS_CONFIGURATION
|
CMS_CONFIGURATION
|
||||||
|
|
||||||
|
inherit
|
||||||
|
ANY
|
||||||
|
|
||||||
|
SHARED_EXECUTION_ENVIRONMENT
|
||||||
|
export
|
||||||
|
{NONE} all
|
||||||
|
end
|
||||||
|
|
||||||
create
|
create
|
||||||
make,
|
make,
|
||||||
make_from_file
|
make_from_file
|
||||||
@@ -15,16 +23,19 @@ feature {NONE} -- Initialization
|
|||||||
|
|
||||||
make
|
make
|
||||||
do
|
do
|
||||||
create options.make (10)
|
create options.make_equal (10)
|
||||||
analyze
|
analyze
|
||||||
end
|
end
|
||||||
|
|
||||||
make_from_file (a_filename: READABLE_STRING_32)
|
make_from_file (a_filename: READABLE_STRING_GENERAL)
|
||||||
-- Initialize `Current'.
|
-- Initialize `Current'.
|
||||||
|
local
|
||||||
|
p: PATH
|
||||||
do
|
do
|
||||||
make
|
make
|
||||||
configuration_location := a_filename
|
create p.make_from_string (a_filename)
|
||||||
import (a_filename)
|
configuration_location := p
|
||||||
|
import_from_path (p)
|
||||||
analyze
|
analyze
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -38,52 +49,54 @@ feature {NONE} -- Initialization
|
|||||||
|
|
||||||
feature -- Access
|
feature -- Access
|
||||||
|
|
||||||
configuration_location: detachable READABLE_STRING_8
|
configuration_location: detachable PATH
|
||||||
|
|
||||||
option (a_name: READABLE_STRING_GENERAL): detachable ANY
|
option (a_name: READABLE_STRING_GENERAL): detachable ANY
|
||||||
do
|
do
|
||||||
Result := options.item (a_name.as_string_8.as_lower)
|
Result := options.item (a_name)
|
||||||
end
|
end
|
||||||
|
|
||||||
options: HASH_TABLE [STRING, STRING]
|
options: STRING_TABLE [STRING_32]
|
||||||
|
|
||||||
feature -- Conversion
|
feature -- Conversion
|
||||||
|
|
||||||
append_to_string (s: STRING)
|
append_to_string (s: STRING)
|
||||||
|
local
|
||||||
|
utf: UTF_CONVERTER
|
||||||
do
|
do
|
||||||
s.append ("Options:%N")
|
s.append ("Options:%N")
|
||||||
across
|
across
|
||||||
options as c
|
options as c
|
||||||
loop
|
loop
|
||||||
s.append (c.key)
|
s.append (c.key.to_string_8)
|
||||||
s.append_character ('=')
|
s.append_character ('=')
|
||||||
s.append (c.key)
|
utf.string_32_into_utf_8_string_8 (c.item, s)
|
||||||
s.append_character ('%N')
|
s.append_character ('%N')
|
||||||
end
|
end
|
||||||
|
|
||||||
s.append ("Specific:%N")
|
s.append ("Specific:%N")
|
||||||
s.append ("root_location=" + root_location + "%N")
|
s.append ("root_location=" + root_location.utf_8_name + "%N")
|
||||||
s.append ("var_location=" + var_location + "%N")
|
s.append ("var_location=" + var_location.utf_8_name + "%N")
|
||||||
s.append ("files_location=" + files_location + "%N")
|
s.append ("files_location=" + files_location.utf_8_name + "%N")
|
||||||
s.append ("themes_location=" + themes_location + "%N")
|
s.append ("themes_location=" + themes_location.utf_8_name + "%N")
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Element change
|
feature -- Element change
|
||||||
|
|
||||||
set_option (a_name: READABLE_STRING_GENERAL; a_value: STRING)
|
set_option (a_name: READABLE_STRING_GENERAL; a_value: STRING_32)
|
||||||
do
|
do
|
||||||
options.force (a_value, a_name.as_string_8)
|
options.force (a_value, a_name.as_string_8)
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Access
|
feature -- Access
|
||||||
|
|
||||||
var_location: READABLE_STRING_8
|
var_location: PATH
|
||||||
|
|
||||||
root_location: READABLE_STRING_8
|
root_location: PATH
|
||||||
|
|
||||||
files_location: STRING
|
files_location: PATH
|
||||||
|
|
||||||
themes_location: STRING
|
themes_location: PATH
|
||||||
|
|
||||||
theme_name (dft: detachable like theme_name): READABLE_STRING_8
|
theme_name (dft: detachable like theme_name): READABLE_STRING_8
|
||||||
do
|
do
|
||||||
@@ -158,67 +171,63 @@ feature -- Change
|
|||||||
|
|
||||||
get_var_location
|
get_var_location
|
||||||
local
|
local
|
||||||
res: STRING_32
|
utf: UTF_CONVERTER
|
||||||
do
|
do
|
||||||
if attached options.item ("var-dir") as s then
|
if attached options.item ("var-dir") as s then
|
||||||
res := s
|
create var_location.make_from_string (utf.utf_8_string_8_to_escaped_string_32 (s))
|
||||||
else
|
else
|
||||||
res := execution_environment.current_working_directory
|
var_location := execution_environment.current_working_path
|
||||||
end
|
end
|
||||||
if res.ends_with ("/") then
|
|
||||||
res.remove_tail (1)
|
|
||||||
end
|
|
||||||
var_location := res
|
|
||||||
end
|
end
|
||||||
|
|
||||||
get_root_location
|
get_root_location
|
||||||
local
|
local
|
||||||
res: STRING_32
|
utf: UTF_CONVERTER
|
||||||
do
|
do
|
||||||
if attached options.item ("root-dir") as s then
|
if attached options.item ("root-dir") as s then
|
||||||
res := s
|
create root_location.make_from_string (utf.utf_8_string_8_to_escaped_string_32 (s))
|
||||||
else
|
else
|
||||||
res := execution_environment.current_working_directory
|
root_location := execution_environment.current_working_path
|
||||||
end
|
end
|
||||||
if res.ends_with ("/") then
|
|
||||||
res.remove_tail (1)
|
|
||||||
end
|
|
||||||
root_location := res
|
|
||||||
end
|
end
|
||||||
|
|
||||||
get_files_location
|
get_files_location
|
||||||
|
local
|
||||||
|
utf: UTF_CONVERTER
|
||||||
do
|
do
|
||||||
if attached options.item ("files-dir") as s then
|
if attached options.item ("files-dir") as s then
|
||||||
files_location := s
|
create files_location.make_from_string (utf.utf_8_string_8_to_escaped_string_32 (s))
|
||||||
else
|
else
|
||||||
files_location := "files"
|
create files_location.make_from_string ("files")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
get_themes_location
|
get_themes_location
|
||||||
local
|
local
|
||||||
dn: DIRECTORY_NAME
|
utf: UTF_CONVERTER
|
||||||
do
|
do
|
||||||
if attached options.item ("themes-dir") as s then
|
if attached options.item ("themes-dir") as s then
|
||||||
themes_location := s
|
create themes_location.make_from_string (utf.utf_8_string_8_to_escaped_string_32 (s))
|
||||||
else
|
else
|
||||||
create dn.make_from_string (root_location)
|
themes_location := root_location.extended ("themes")
|
||||||
dn.extend ("themes")
|
|
||||||
themes_location := dn.string
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
feature {NONE} -- Implementation
|
feature {NONE} -- Implementation
|
||||||
|
|
||||||
import (a_filename: READABLE_STRING_32)
|
import_from_file (fn: READABLE_STRING_GENERAL)
|
||||||
|
do
|
||||||
|
import_from_path (create {PATH}.make_from_string (fn))
|
||||||
|
end
|
||||||
|
|
||||||
|
import_from_path (a_filename: PATH)
|
||||||
-- Import ini file content
|
-- Import ini file content
|
||||||
local
|
local
|
||||||
f: PLAIN_TEXT_FILE
|
f: PLAIN_TEXT_FILE
|
||||||
l,v: STRING_8
|
l,v: STRING_8
|
||||||
p: INTEGER
|
p: INTEGER
|
||||||
do
|
do
|
||||||
--FIXME: handle unicode filename here.
|
create f.make_with_path (a_filename)
|
||||||
create f.make (a_filename)
|
|
||||||
if f.exists and f.is_readable then
|
if f.exists and f.is_readable then
|
||||||
f.open_read
|
f.open_read
|
||||||
from
|
from
|
||||||
@@ -241,7 +250,7 @@ feature {NONE} -- Implementation
|
|||||||
l.right_adjust
|
l.right_adjust
|
||||||
|
|
||||||
if l.is_case_insensitive_equal ("@include") then
|
if l.is_case_insensitive_equal ("@include") then
|
||||||
import (resolved_string (v))
|
import_from_file (resolved_string (v))
|
||||||
else
|
else
|
||||||
set_option (l.as_lower, resolved_string (v))
|
set_option (l.as_lower, resolved_string (v))
|
||||||
end
|
end
|
||||||
@@ -256,12 +265,7 @@ feature {NONE} -- Implementation
|
|||||||
|
|
||||||
feature {NONE} -- Environment
|
feature {NONE} -- Environment
|
||||||
|
|
||||||
Execution_environment: EXECUTION_ENVIRONMENT
|
resolved_string (s: READABLE_STRING_8): STRING_32
|
||||||
once
|
|
||||||
create Result
|
|
||||||
end
|
|
||||||
|
|
||||||
resolved_string (s: READABLE_STRING_8): STRING
|
|
||||||
-- Resolved `s' using `options' or else environment variables.
|
-- Resolved `s' using `options' or else environment variables.
|
||||||
local
|
local
|
||||||
i,n,b,e: INTEGER
|
i,n,b,e: INTEGER
|
||||||
@@ -280,9 +284,13 @@ feature {NONE} -- Environment
|
|||||||
if e > 0 then
|
if e > 0 then
|
||||||
k := s.substring (b, e)
|
k := s.substring (b, e)
|
||||||
if attached option (k) as v then
|
if attached option (k) as v then
|
||||||
Result.append (v.out)
|
if attached {READABLE_STRING_32} v as s32 then
|
||||||
|
Result.append (s32)
|
||||||
|
else
|
||||||
|
Result.append (v.out)
|
||||||
|
end
|
||||||
i := e + 1
|
i := e + 1
|
||||||
elseif attached execution_environment.get (k) as v then
|
elseif attached execution_environment.item (k) as v then
|
||||||
Result.append (v)
|
Result.append (v)
|
||||||
i := e + 1
|
i := e + 1
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ feature {NONE} -- Initialization
|
|||||||
default_create
|
default_create
|
||||||
end
|
end
|
||||||
|
|
||||||
make_from_file (fn: READABLE_STRING_8)
|
make_from_file (fn: READABLE_STRING_GENERAL)
|
||||||
local
|
local
|
||||||
cfg: CMS_CONFIGURATION
|
cfg: CMS_CONFIGURATION
|
||||||
do
|
do
|
||||||
@@ -83,29 +83,27 @@ feature {NONE} -- Initialization
|
|||||||
|
|
||||||
build_storage
|
build_storage
|
||||||
local
|
local
|
||||||
dn: DIRECTORY_NAME
|
dn: PATH
|
||||||
do
|
do
|
||||||
if attached configuration as cfg and then attached cfg.var_location as l_site_var_dir then
|
if attached configuration as cfg and then attached cfg.var_location as l_site_var_dir then
|
||||||
create dn.make_from_string (l_site_var_dir)
|
dn := l_site_var_dir
|
||||||
else
|
else
|
||||||
create dn.make
|
create dn.make_current
|
||||||
end
|
end
|
||||||
dn.extend ("_storage_")
|
create {CMS_SED_STORAGE} storage.make (dn.extended ("_storage_").name)
|
||||||
create {CMS_SED_STORAGE} storage.make (dn.string)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
build_session_manager
|
build_session_manager
|
||||||
local
|
local
|
||||||
dn: DIRECTORY_NAME
|
dn: PATH
|
||||||
do
|
do
|
||||||
if attached configuration as cfg and then attached cfg.var_location as l_site_var_dir then
|
if attached configuration as cfg and then attached cfg.var_location as l_site_var_dir then
|
||||||
create dn.make_from_string (l_site_var_dir)
|
dn := l_site_var_dir
|
||||||
else
|
else
|
||||||
create dn.make
|
create dn.make_empty
|
||||||
end
|
end
|
||||||
dn.extend ("_storage_")
|
dn := dn.extended ("_storage_").extended ("_sessions_")
|
||||||
dn.extend ("_sessions_")
|
create {WSF_FS_SESSION_MANAGER} session_manager.make_with_folder (dn.name)
|
||||||
create {WSF_FS_SESSION_MANAGER} session_manager.make_with_folder (dn.string)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
build_auth_engine
|
build_auth_engine
|
||||||
|
|||||||
@@ -110,7 +110,6 @@ feature {NONE} -- Initialization
|
|||||||
local
|
local
|
||||||
-- h: CMS_HANDLER
|
-- h: CMS_HANDLER
|
||||||
file_hdl: CMS_FILE_SYSTEM_HANDLER
|
file_hdl: CMS_FILE_SYSTEM_HANDLER
|
||||||
dn: DIRECTORY_NAME
|
|
||||||
do
|
do
|
||||||
create router.make (10)
|
create router.make (10)
|
||||||
router.set_base_url (base_url)
|
router.set_base_url (base_url)
|
||||||
@@ -118,13 +117,12 @@ feature {NONE} -- Initialization
|
|||||||
router.map (create {WSF_URI_MAPPING}.make ("/", create {CMS_HANDLER}.make (agent handle_home)))
|
router.map (create {WSF_URI_MAPPING}.make ("/", create {CMS_HANDLER}.make (agent handle_home)))
|
||||||
router.map (create {WSF_URI_MAPPING}.make ("/favicon.ico", create {CMS_HANDLER}.make (agent handle_favicon)))
|
router.map (create {WSF_URI_MAPPING}.make ("/favicon.ico", create {CMS_HANDLER}.make (agent handle_favicon)))
|
||||||
|
|
||||||
create file_hdl.make (files_location)
|
create file_hdl.make_with_path (files_location)
|
||||||
file_hdl.disable_index
|
file_hdl.disable_index
|
||||||
file_hdl.set_max_age (8*60*60)
|
file_hdl.set_max_age (8*60*60)
|
||||||
router.map (create {WSF_STARTS_WITH_MAPPING}.make ("/files/", file_hdl))
|
router.map (create {WSF_STARTS_WITH_MAPPING}.make ("/files/", file_hdl))
|
||||||
|
|
||||||
create dn.make_from_string (theme_resource_location)
|
create file_hdl.make_with_path (theme_resource_location)
|
||||||
create file_hdl.make (theme_resource_location)
|
|
||||||
file_hdl.set_max_age (8*60*60)
|
file_hdl.set_max_age (8*60*60)
|
||||||
router.map (create {WSF_STARTS_WITH_MAPPING}.make ("/theme/", file_hdl))
|
router.map (create {WSF_STARTS_WITH_MAPPING}.make ("/theme/", file_hdl))
|
||||||
end
|
end
|
||||||
@@ -257,25 +255,20 @@ feature -- Router
|
|||||||
|
|
||||||
site_url: READABLE_STRING_8
|
site_url: READABLE_STRING_8
|
||||||
|
|
||||||
site_dir: READABLE_STRING_8
|
site_dir: PATH
|
||||||
|
|
||||||
site_var_dir: READABLE_STRING_8
|
site_var_dir: PATH
|
||||||
|
|
||||||
files_location: READABLE_STRING_8
|
files_location: PATH
|
||||||
|
|
||||||
themes_location: READABLE_STRING_8
|
themes_location: PATH
|
||||||
|
|
||||||
compute_theme_resource_location
|
compute_theme_resource_location
|
||||||
local
|
|
||||||
dn: DIRECTORY_NAME
|
|
||||||
do
|
do
|
||||||
create dn.make_from_string (themes_location)
|
theme_resource_location := themes_location.extended (theme_name).extended ("res")
|
||||||
dn.extend (theme_name)
|
|
||||||
dn.extend ("res")
|
|
||||||
theme_resource_location := dn.string
|
|
||||||
end
|
end
|
||||||
|
|
||||||
theme_resource_location: READABLE_STRING_8
|
theme_resource_location: PATH
|
||||||
|
|
||||||
theme_name: READABLE_STRING_32
|
theme_name: READABLE_STRING_32
|
||||||
|
|
||||||
@@ -420,11 +413,8 @@ feature -- Core Execution
|
|||||||
handle_favicon (req: WSF_REQUEST; res: WSF_RESPONSE)
|
handle_favicon (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||||
local
|
local
|
||||||
fres: WSF_FILE_RESPONSE
|
fres: WSF_FILE_RESPONSE
|
||||||
fn: FILE_NAME
|
|
||||||
do
|
do
|
||||||
create fn.make_from_string (theme_resource_location)
|
create fres.make_with_path (theme_resource_location.extended ("favicon.ico"))
|
||||||
fn.set_file_name ("favicon.ico")
|
|
||||||
create fres.make (fn.string)
|
|
||||||
fres.set_expires_in_seconds (7 * 24 * 60 * 60) -- 7 jours
|
fres.set_expires_in_seconds (7 * 24 * 60 * 60) -- 7 jours
|
||||||
res.send (fres)
|
res.send (fres)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ inherit
|
|||||||
WSF_FILE_SYSTEM_HANDLER
|
WSF_FILE_SYSTEM_HANDLER
|
||||||
|
|
||||||
create
|
create
|
||||||
make
|
make,
|
||||||
|
make_with_path
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -45,7 +45,6 @@ feature -- Conversion
|
|||||||
i: INTEGER
|
i: INTEGER
|
||||||
n: INTEGER
|
n: INTEGER
|
||||||
in_tag: BOOLEAN
|
in_tag: BOOLEAN
|
||||||
t: READABLE_STRING_8
|
|
||||||
p1, p2: INTEGER
|
p1, p2: INTEGER
|
||||||
do
|
do
|
||||||
create l_new.make (a_text.count)
|
create l_new.make (a_text.count)
|
||||||
|
|||||||
@@ -13,6 +13,11 @@ inherit
|
|||||||
|
|
||||||
CMS_HOOK_AUTO_REGISTER
|
CMS_HOOK_AUTO_REGISTER
|
||||||
|
|
||||||
|
SHARED_EXECUTION_ENVIRONMENT
|
||||||
|
export
|
||||||
|
{NONE} all
|
||||||
|
end
|
||||||
|
|
||||||
create
|
create
|
||||||
make
|
make
|
||||||
|
|
||||||
@@ -68,22 +73,22 @@ feature -- Handler
|
|||||||
|
|
||||||
if attached cms.configuration as cfg and then attached cfg.configuration_location as l_loc then
|
if attached cms.configuration as cfg and then attached cfg.configuration_location as l_loc then
|
||||||
s.append ("<hr/>")
|
s.append ("<hr/>")
|
||||||
append_info_to ("Configuration file", l_loc, e, s)
|
append_info_to ("Configuration file", l_loc.name, e, s)
|
||||||
end
|
end
|
||||||
|
|
||||||
s.append ("<hr/>")
|
s.append ("<hr/>")
|
||||||
|
|
||||||
append_info_to ("Current dir", (create {EXECUTION_ENVIRONMENT}).current_working_directory, e, s)
|
append_info_to ("Current dir", execution_environment.current_working_path.utf_8_name, e, s)
|
||||||
append_info_to ("Base url", cms.base_url, e, s)
|
append_info_to ("Base url", cms.base_url, e, s)
|
||||||
append_info_to ("Script url", cms.script_url, e, s)
|
append_info_to ("Script url", cms.script_url, e, s)
|
||||||
s.append ("<hr/>")
|
s.append ("<hr/>")
|
||||||
append_info_to ("Dir", cms.site_dir, e, s)
|
append_info_to ("Dir", cms.site_dir.utf_8_name, e, s)
|
||||||
append_info_to ("Var dir", cms.site_var_dir, e, s)
|
append_info_to ("Var dir", cms.site_var_dir.utf_8_name, e, s)
|
||||||
s.append ("<hr/>")
|
s.append ("<hr/>")
|
||||||
append_info_to ("Theme", cms.theme_name, e, s)
|
append_info_to ("Theme", cms.theme_name, e, s)
|
||||||
append_info_to ("Theme location", cms.theme_resource_location, e, s)
|
append_info_to ("Theme location", cms.theme_resource_location.utf_8_name, e, s)
|
||||||
s.append ("<hr/>")
|
s.append ("<hr/>")
|
||||||
append_info_to ("Files location", cms.files_location, e, s)
|
append_info_to ("Files location", cms.files_location.utf_8_name, e, s)
|
||||||
s.append ("<hr/>")
|
s.append ("<hr/>")
|
||||||
|
|
||||||
append_info_to ("Url", e.url ("/", Void), e, s)
|
append_info_to ("Url", e.url ("/", Void), e, s)
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ feature -- Execution
|
|||||||
|
|
||||||
password_form_submit (fd: WSF_FORM_DATA; b: STRING)
|
password_form_submit (fd: WSF_FORM_DATA; b: STRING)
|
||||||
local
|
local
|
||||||
e: detachable NOTIFICATION_EMAIL
|
e: detachable CMS_EMAIL
|
||||||
l_uuid: UUID
|
l_uuid: UUID
|
||||||
do
|
do
|
||||||
debug
|
debug
|
||||||
@@ -144,7 +144,7 @@ feature -- Execution
|
|||||||
Result := f
|
Result := f
|
||||||
end
|
end
|
||||||
|
|
||||||
new_password_email (u: CMS_USER; a_mail_address: STRING; a_extra: READABLE_STRING_8): NOTIFICATION_EMAIL
|
new_password_email (u: CMS_USER; a_mail_address: STRING; a_extra: READABLE_STRING_8): CMS_EMAIL
|
||||||
local
|
local
|
||||||
b: STRING
|
b: STRING
|
||||||
opts: CMS_URL_API_OPTIONS
|
opts: CMS_URL_API_OPTIONS
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ feature -- Execution
|
|||||||
b: STRING
|
b: STRING
|
||||||
u: detachable CMS_USER
|
u: detachable CMS_USER
|
||||||
up: detachable CMS_USER_PROFILE
|
up: detachable CMS_USER_PROFILE
|
||||||
e: detachable NOTIFICATION_EMAIL
|
e: detachable CMS_EMAIL
|
||||||
l_pass: detachable READABLE_STRING_32
|
l_pass: detachable READABLE_STRING_32
|
||||||
l_uuid: UUID
|
l_uuid: UUID
|
||||||
do
|
do
|
||||||
@@ -174,7 +174,7 @@ feature -- Execution
|
|||||||
Result := f
|
Result := f
|
||||||
end
|
end
|
||||||
|
|
||||||
new_registration_email (a_mail_address: STRING; u: CMS_USER; a_password: detachable like {CMS_USER}.password; a_extra: READABLE_STRING_8): NOTIFICATION_EMAIL
|
new_registration_email (a_mail_address: STRING; u: CMS_USER; a_password: detachable like {CMS_USER}.password; a_extra: READABLE_STRING_8): CMS_EMAIL
|
||||||
require
|
require
|
||||||
has_clear_password: u.password /= Void or else a_password /= Void
|
has_clear_password: u.password /= Void or else a_password /= Void
|
||||||
local
|
local
|
||||||
@@ -202,7 +202,7 @@ feature -- Execution
|
|||||||
create Result.make (service.site_email, a_mail_address, "Account details for " + u.name + " at " + service.site_name, b)
|
create Result.make (service.site_email, a_mail_address, "Account details for " + u.name + " at " + service.site_name, b)
|
||||||
end
|
end
|
||||||
|
|
||||||
new_user_account_email (a_mail_address: STRING; u: CMS_USER): NOTIFICATION_EMAIL
|
new_user_account_email (a_mail_address: STRING; u: CMS_USER): CMS_EMAIL
|
||||||
local
|
local
|
||||||
b: STRING
|
b: STRING
|
||||||
opts: CMS_URL_API_OPTIONS
|
opts: CMS_URL_API_OPTIONS
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
note
|
note
|
||||||
description : "[
|
description : "[
|
||||||
Component representing an email for the CMS
|
Component representing an email
|
||||||
]"
|
]"
|
||||||
author : "$Author$"
|
author : "$Author$"
|
||||||
date : "$Date$"
|
date : "$Date$"
|
||||||
|
|||||||
@@ -16,16 +16,16 @@ create
|
|||||||
|
|
||||||
feature {NONE} -- Initialization
|
feature {NONE} -- Initialization
|
||||||
|
|
||||||
make (dn: STRING)
|
make (dn: READABLE_STRING_GENERAL)
|
||||||
-- Initialize `Current'.
|
-- Initialize `Current'.
|
||||||
do
|
do
|
||||||
directory_name := dn
|
create directory_name.make_from_string (dn)
|
||||||
ensure_directory_exists (dn)
|
ensure_directory_exists (directory_name)
|
||||||
create sed
|
create sed
|
||||||
initialize
|
initialize
|
||||||
end
|
end
|
||||||
|
|
||||||
directory_name: STRING
|
directory_name: PATH
|
||||||
|
|
||||||
sed: SED_STORABLE_FACILITIES
|
sed: SED_STORABLE_FACILITIES
|
||||||
|
|
||||||
@@ -49,18 +49,14 @@ feature {NONE} -- Initialization
|
|||||||
|
|
||||||
save_object_with_id (obj: ANY; a_id: INTEGER; a_type: STRING)
|
save_object_with_id (obj: ANY; a_id: INTEGER; a_type: STRING)
|
||||||
local
|
local
|
||||||
dn: STRING
|
fn: PATH
|
||||||
fn: FILE_NAME
|
|
||||||
f: RAW_FILE
|
f: RAW_FILE
|
||||||
do
|
do
|
||||||
create fn.make_from_string (directory_name)
|
fn := directory_name.extended (a_type)
|
||||||
fn.extend (a_type)
|
ensure_directory_exists (fn)
|
||||||
dn := fn.string
|
fn := fn.extended (a_id.out)
|
||||||
ensure_directory_exists (dn)
|
-- .appended_with_extension ("txt")
|
||||||
create fn.make_from_string (dn)
|
create f.make_with_path (fn)
|
||||||
fn.set_file_name (a_id.out)
|
|
||||||
-- fn.add_extension ("txt")
|
|
||||||
create f.make (fn.string)
|
|
||||||
-- check not f.exists end
|
-- check not f.exists end
|
||||||
f.create_read_write
|
f.create_read_write
|
||||||
sed_file_store (obj, f)
|
sed_file_store (obj, f)
|
||||||
@@ -69,18 +65,14 @@ feature {NONE} -- Initialization
|
|||||||
|
|
||||||
object_with_id (a_id: INTEGER; a_type: STRING): detachable ANY
|
object_with_id (a_id: INTEGER; a_type: STRING): detachable ANY
|
||||||
local
|
local
|
||||||
dn: STRING
|
fn: PATH
|
||||||
fn: FILE_NAME
|
|
||||||
f: RAW_FILE
|
f: RAW_FILE
|
||||||
do
|
do
|
||||||
create fn.make_from_string (directory_name)
|
fn := directory_name.extended (a_type)
|
||||||
fn.extend (a_type)
|
ensure_directory_exists (fn)
|
||||||
dn := fn.string
|
fn := fn.extended (a_id.out)
|
||||||
ensure_directory_exists (dn)
|
-- .append_with_extension ("txt")
|
||||||
create fn.make_from_string (dn)
|
create f.make_with_path (fn)
|
||||||
fn.set_file_name (a_id.out)
|
|
||||||
-- fn.add_extension ("txt")
|
|
||||||
create f.make (fn.string)
|
|
||||||
if f.exists and f.is_readable then
|
if f.exists and f.is_readable then
|
||||||
f.open_read
|
f.open_read
|
||||||
Result := sed_file_retrieved (f)
|
Result := sed_file_retrieved (f)
|
||||||
@@ -261,30 +253,24 @@ feature -- Email
|
|||||||
|
|
||||||
save_email (a_email: NOTIFICATION_EMAIL)
|
save_email (a_email: NOTIFICATION_EMAIL)
|
||||||
local
|
local
|
||||||
dn: STRING
|
dn: PATH
|
||||||
fn: FILE_NAME
|
fn: PATH
|
||||||
f: RAW_FILE
|
f: RAW_FILE
|
||||||
ts: INTEGER_64
|
ts: INTEGER_64
|
||||||
i: INTEGER
|
i: INTEGER
|
||||||
do
|
do
|
||||||
create fn.make_from_string (directory_name)
|
dn := directory_name.extended ("emails")
|
||||||
fn.extend ("emails")
|
|
||||||
dn := fn.string
|
|
||||||
ensure_directory_exists (dn)
|
ensure_directory_exists (dn)
|
||||||
ts := (create {HTTP_DATE_TIME_UTILITIES}).unix_time_stamp (a_email.date)
|
ts := (create {HTTP_DATE_TIME_UTILITIES}).unix_time_stamp (a_email.date)
|
||||||
from
|
from
|
||||||
create fn.make_from_string (dn)
|
fn := dn.extended (ts.out).appended_with_extension ("txt")
|
||||||
fn.set_file_name (ts.out)
|
create f.make_with_path (fn)
|
||||||
fn.add_extension ("txt")
|
|
||||||
create f.make (fn.string)
|
|
||||||
until
|
until
|
||||||
not f.exists
|
not f.exists
|
||||||
loop
|
loop
|
||||||
i := i + 1
|
i := i + 1
|
||||||
create fn.make_from_string (dn)
|
fn := dn.extended (ts.out + "-" + i.out).appended_with_extension ("txt")
|
||||||
fn.set_file_name (ts.out + "-" + i.out)
|
f.make_with_path (fn)
|
||||||
fn.add_extension ("txt")
|
|
||||||
f.make (fn.string)
|
|
||||||
end
|
end
|
||||||
f.create_read_write
|
f.create_read_write
|
||||||
f.put_string (a_email.message)
|
f.put_string (a_email.message)
|
||||||
@@ -388,13 +374,11 @@ feature {NONE} -- Implementation
|
|||||||
|
|
||||||
last_sequence (a_type: STRING): INTEGER
|
last_sequence (a_type: STRING): INTEGER
|
||||||
local
|
local
|
||||||
fn: FILE_NAME
|
fn: PATH
|
||||||
f: RAW_FILE
|
f: RAW_FILE
|
||||||
do
|
do
|
||||||
create fn.make_from_string (directory_name)
|
fn := directory_name.extended (a_type).appended_with_extension ("last_id")
|
||||||
fn.set_file_name (a_type)
|
create f.make_with_path (fn)
|
||||||
fn.add_extension ("last_id")
|
|
||||||
create f.make (fn.string)
|
|
||||||
if f.exists and then f.is_readable then
|
if f.exists and then f.is_readable then
|
||||||
f.open_read
|
f.open_read
|
||||||
f.read_line
|
f.read_line
|
||||||
@@ -409,13 +393,11 @@ feature {NONE} -- Implementation
|
|||||||
|
|
||||||
next_sequence (a_type: STRING): INTEGER
|
next_sequence (a_type: STRING): INTEGER
|
||||||
local
|
local
|
||||||
fn: FILE_NAME
|
fn: PATH
|
||||||
f: RAW_FILE
|
f: RAW_FILE
|
||||||
do
|
do
|
||||||
create fn.make_from_string (directory_name)
|
fn := directory_name.extended (a_type).appended_with_extension ("last_id")
|
||||||
fn.set_file_name (a_type)
|
create f.make_with_path (fn)
|
||||||
fn.add_extension ("last_id")
|
|
||||||
create f.make (fn.string)
|
|
||||||
if f.exists and then f.is_readable then
|
if f.exists and then f.is_readable then
|
||||||
f.open_read
|
f.open_read
|
||||||
f.read_line
|
f.read_line
|
||||||
@@ -439,13 +421,12 @@ feature {NONE} -- Implementation
|
|||||||
]
|
]
|
||||||
local
|
local
|
||||||
f: RAW_FILE
|
f: RAW_FILE
|
||||||
fn: FILE_NAME
|
fn: PATH
|
||||||
res: detachable like users_index
|
res: detachable like users_index
|
||||||
retried: INTEGER
|
retried: INTEGER
|
||||||
do
|
do
|
||||||
create fn.make_from_string (directory_name)
|
fn := directory_name.extended ("users.db")
|
||||||
fn.set_file_name ("users.db")
|
create f.make_with_path (fn)
|
||||||
create f.make (fn.string)
|
|
||||||
if retried = 0 then
|
if retried = 0 then
|
||||||
if f.exists and then f.is_readable then
|
if f.exists and then f.is_readable then
|
||||||
f.open_read
|
f.open_read
|
||||||
@@ -469,11 +450,10 @@ feature {NONE} -- Implementation
|
|||||||
store_users_index (a_users_index: like users_index)
|
store_users_index (a_users_index: like users_index)
|
||||||
local
|
local
|
||||||
f: RAW_FILE
|
f: RAW_FILE
|
||||||
fn: FILE_NAME
|
fn: PATH
|
||||||
do
|
do
|
||||||
create fn.make_from_string (directory_name)
|
fn := directory_name.extended ("users.db")
|
||||||
fn.set_file_name ("users.db")
|
create f.make_with_path (fn)
|
||||||
create f.make (fn.string)
|
|
||||||
if not f.exists or else f.is_writable then
|
if not f.exists or else f.is_writable then
|
||||||
f.open_write
|
f.open_write
|
||||||
sed_file_store (a_users_index, f)
|
sed_file_store (a_users_index, f)
|
||||||
@@ -612,12 +592,12 @@ feature -- Misc
|
|||||||
|
|
||||||
feature {NONE} -- Implementation
|
feature {NONE} -- Implementation
|
||||||
|
|
||||||
ensure_directory_exists (dn: STRING)
|
ensure_directory_exists (dn: PATH)
|
||||||
local
|
local
|
||||||
d: DIRECTORY
|
d: DIRECTORY
|
||||||
do
|
do
|
||||||
d := tmp_dir
|
d := tmp_dir
|
||||||
d.make (dn)
|
d.make_with_path (dn)
|
||||||
if not d.exists then
|
if not d.exists then
|
||||||
d.recursive_create_dir
|
d.recursive_create_dir
|
||||||
end
|
end
|
||||||
@@ -627,7 +607,7 @@ feature {NONE} -- Implementation
|
|||||||
|
|
||||||
tmp_dir: DIRECTORY
|
tmp_dir: DIRECTORY
|
||||||
once
|
once
|
||||||
create Result.make (directory_name)
|
create Result.make_with_path (directory_name)
|
||||||
end
|
end
|
||||||
|
|
||||||
invariant
|
invariant
|
||||||
|
|||||||
Reference in New Issue
Block a user