diff --git a/draft/application/cms/example/src/web_cms.e b/draft/application/cms/example/src/web_cms.e index 0ccfd7da..716da98f 100644 --- a/draft/application/cms/example/src/web_cms.e +++ b/draft/application/cms/example/src/web_cms.e @@ -20,8 +20,8 @@ feature {NONE} -- Initialization initialize local - args: ARGUMENTS - cfg: detachable STRING + args: ARGUMENTS_32 + cfg: detachable READABLE_STRING_32 i,n: INTEGER do --| Arguments @@ -33,7 +33,7 @@ feature {NONE} -- Initialization i > n or cfg /= Void loop 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 cfg := args.argument (i + 1) end @@ -43,7 +43,7 @@ feature {NONE} -- Initialization end if cfg = Void then if file_exists ("cms.ini") then - cfg := "cms.ini" + cfg := {STRING_32} "cms.ini" end end @@ -55,7 +55,7 @@ feature {NONE} -- Initialization launch_cms (cms_setup (cfg)) 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 if a_cfg_fn /= Void then create Result.make_from_file (a_cfg_fn) @@ -124,11 +124,11 @@ feature -- Event feature -- Helper - file_exists (fn: STRING): BOOLEAN + file_exists (fn: READABLE_STRING_GENERAL): BOOLEAN local f: RAW_FILE do - create f.make (fn) + create f.make_with_name (fn) Result := f.exists and then f.is_readable end diff --git a/draft/application/cms/src/cms_configuration.e b/draft/application/cms/src/cms_configuration.e index c229c5f1..937629e3 100644 --- a/draft/application/cms/src/cms_configuration.e +++ b/draft/application/cms/src/cms_configuration.e @@ -7,6 +7,14 @@ note class CMS_CONFIGURATION +inherit + ANY + + SHARED_EXECUTION_ENVIRONMENT + export + {NONE} all + end + create make, make_from_file @@ -15,16 +23,19 @@ feature {NONE} -- Initialization make do - create options.make (10) + create options.make_equal (10) analyze end - make_from_file (a_filename: READABLE_STRING_32) + make_from_file (a_filename: READABLE_STRING_GENERAL) -- Initialize `Current'. + local + p: PATH do make - configuration_location := a_filename - import (a_filename) + create p.make_from_string (a_filename) + configuration_location := p + import_from_path (p) analyze end @@ -38,52 +49,54 @@ feature {NONE} -- Initialization feature -- Access - configuration_location: detachable READABLE_STRING_8 + configuration_location: detachable PATH option (a_name: READABLE_STRING_GENERAL): detachable ANY do - Result := options.item (a_name.as_string_8.as_lower) + Result := options.item (a_name) end - options: HASH_TABLE [STRING, STRING] + options: STRING_TABLE [STRING_32] feature -- Conversion append_to_string (s: STRING) + local + utf: UTF_CONVERTER do s.append ("Options:%N") across options as c loop - s.append (c.key) + s.append (c.key.to_string_8) s.append_character ('=') - s.append (c.key) + utf.string_32_into_utf_8_string_8 (c.item, s) s.append_character ('%N') end s.append ("Specific:%N") - s.append ("root_location=" + root_location + "%N") - s.append ("var_location=" + var_location + "%N") - s.append ("files_location=" + files_location + "%N") - s.append ("themes_location=" + themes_location + "%N") + s.append ("root_location=" + root_location.utf_8_name + "%N") + s.append ("var_location=" + var_location.utf_8_name + "%N") + s.append ("files_location=" + files_location.utf_8_name + "%N") + s.append ("themes_location=" + themes_location.utf_8_name + "%N") end 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 options.force (a_value, a_name.as_string_8) end 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 do @@ -158,67 +171,63 @@ feature -- Change get_var_location local - res: STRING_32 + utf: UTF_CONVERTER do 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 - res := execution_environment.current_working_directory + var_location := execution_environment.current_working_path end - if res.ends_with ("/") then - res.remove_tail (1) - end - var_location := res end get_root_location local - res: STRING_32 + utf: UTF_CONVERTER do 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 - res := execution_environment.current_working_directory + root_location := execution_environment.current_working_path end - if res.ends_with ("/") then - res.remove_tail (1) - end - root_location := res end get_files_location + local + utf: UTF_CONVERTER do 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 - files_location := "files" + create files_location.make_from_string ("files") end end get_themes_location local - dn: DIRECTORY_NAME + utf: UTF_CONVERTER do 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 - create dn.make_from_string (root_location) - dn.extend ("themes") - themes_location := dn.string + themes_location := root_location.extended ("themes") end end 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 local f: PLAIN_TEXT_FILE l,v: STRING_8 p: INTEGER do - --FIXME: handle unicode filename here. - create f.make (a_filename) + create f.make_with_path (a_filename) if f.exists and f.is_readable then f.open_read from @@ -241,7 +250,7 @@ feature {NONE} -- Implementation l.right_adjust if l.is_case_insensitive_equal ("@include") then - import (resolved_string (v)) + import_from_file (resolved_string (v)) else set_option (l.as_lower, resolved_string (v)) end @@ -256,12 +265,7 @@ feature {NONE} -- Implementation feature {NONE} -- Environment - Execution_environment: EXECUTION_ENVIRONMENT - once - create Result - end - - resolved_string (s: READABLE_STRING_8): STRING + resolved_string (s: READABLE_STRING_8): STRING_32 -- Resolved `s' using `options' or else environment variables. local i,n,b,e: INTEGER @@ -280,9 +284,13 @@ feature {NONE} -- Environment if e > 0 then k := s.substring (b, e) 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 - elseif attached execution_environment.get (k) as v then + elseif attached execution_environment.item (k) as v then Result.append (v) i := e + 1 else diff --git a/draft/application/cms/src/cms_default_setup.e b/draft/application/cms/src/cms_default_setup.e index 9cfdd2fa..96002a52 100644 --- a/draft/application/cms/src/cms_default_setup.e +++ b/draft/application/cms/src/cms_default_setup.e @@ -26,7 +26,7 @@ feature {NONE} -- Initialization default_create end - make_from_file (fn: READABLE_STRING_8) + make_from_file (fn: READABLE_STRING_GENERAL) local cfg: CMS_CONFIGURATION do @@ -83,29 +83,27 @@ feature {NONE} -- Initialization build_storage local - dn: DIRECTORY_NAME + dn: PATH do 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 - create dn.make + create dn.make_current end - dn.extend ("_storage_") - create {CMS_SED_STORAGE} storage.make (dn.string) + create {CMS_SED_STORAGE} storage.make (dn.extended ("_storage_").name) end build_session_manager local - dn: DIRECTORY_NAME + dn: PATH do 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 - create dn.make + create dn.make_empty end - dn.extend ("_storage_") - dn.extend ("_sessions_") - create {WSF_FS_SESSION_MANAGER} session_manager.make_with_folder (dn.string) + dn := dn.extended ("_storage_").extended ("_sessions_") + create {WSF_FS_SESSION_MANAGER} session_manager.make_with_folder (dn.name) end build_auth_engine diff --git a/draft/application/cms/src/cms_service.e b/draft/application/cms/src/cms_service.e index a9b846c9..c0bab037 100644 --- a/draft/application/cms/src/cms_service.e +++ b/draft/application/cms/src/cms_service.e @@ -110,7 +110,6 @@ feature {NONE} -- Initialization local -- h: CMS_HANDLER file_hdl: CMS_FILE_SYSTEM_HANDLER - dn: DIRECTORY_NAME do create router.make (10) 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 ("/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.set_max_age (8*60*60) router.map (create {WSF_STARTS_WITH_MAPPING}.make ("/files/", file_hdl)) - create dn.make_from_string (theme_resource_location) - create file_hdl.make (theme_resource_location) + create file_hdl.make_with_path (theme_resource_location) file_hdl.set_max_age (8*60*60) router.map (create {WSF_STARTS_WITH_MAPPING}.make ("/theme/", file_hdl)) end @@ -257,25 +255,20 @@ feature -- Router 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 - local - dn: DIRECTORY_NAME do - create dn.make_from_string (themes_location) - dn.extend (theme_name) - dn.extend ("res") - theme_resource_location := dn.string + theme_resource_location := themes_location.extended (theme_name).extended ("res") end - theme_resource_location: READABLE_STRING_8 + theme_resource_location: PATH theme_name: READABLE_STRING_32 @@ -420,11 +413,8 @@ feature -- Core Execution handle_favicon (req: WSF_REQUEST; res: WSF_RESPONSE) local fres: WSF_FILE_RESPONSE - fn: FILE_NAME do - create fn.make_from_string (theme_resource_location) - fn.set_file_name ("favicon.ico") - create fres.make (fn.string) + create fres.make_with_path (theme_resource_location.extended ("favicon.ico")) fres.set_expires_in_seconds (7 * 24 * 60 * 60) -- 7 jours res.send (fres) end diff --git a/draft/application/cms/src/handler/cms_file_system_handler.e b/draft/application/cms/src/handler/cms_file_system_handler.e index b90630dc..6e36d089 100644 --- a/draft/application/cms/src/handler/cms_file_system_handler.e +++ b/draft/application/cms/src/handler/cms_file_system_handler.e @@ -11,6 +11,7 @@ inherit WSF_FILE_SYSTEM_HANDLER create - make + make, + make_with_path end diff --git a/draft/application/cms/src/kernel/content/format/filters/cms_html_filter.e b/draft/application/cms/src/kernel/content/format/filters/cms_html_filter.e index bc35b4eb..55c509e6 100644 --- a/draft/application/cms/src/kernel/content/format/filters/cms_html_filter.e +++ b/draft/application/cms/src/kernel/content/format/filters/cms_html_filter.e @@ -45,7 +45,6 @@ feature -- Conversion i: INTEGER n: INTEGER in_tag: BOOLEAN - t: READABLE_STRING_8 p1, p2: INTEGER do create l_new.make (a_text.count) diff --git a/draft/application/cms/src/modules/debug/debug_module.e b/draft/application/cms/src/modules/debug/debug_module.e index 1c472116..6444fc4c 100644 --- a/draft/application/cms/src/modules/debug/debug_module.e +++ b/draft/application/cms/src/modules/debug/debug_module.e @@ -13,6 +13,11 @@ inherit CMS_HOOK_AUTO_REGISTER + SHARED_EXECUTION_ENVIRONMENT + export + {NONE} all + end + create make @@ -68,22 +73,22 @@ feature -- Handler if attached cms.configuration as cfg and then attached cfg.configuration_location as l_loc then s.append ("