reverted renaming to use `modules' for available modules.

Added CMS_SETUP.register_module (m) to avoid extending directly to the CMS_SETUP.modules
This commit is contained in:
2014-11-20 14:53:54 +01:00
parent ba58fcdf75
commit 51462829c7
4 changed files with 47 additions and 23 deletions

View File

@@ -101,7 +101,7 @@ feature {NONE} -- Launch operation
feature -- CMS Initialization feature -- CMS Initialization
cms_setup: CMS_CUSTOM_SETUP cms_setup: CMS_DEFAULT_SETUP
do do
if attached separate_character_option_value ('d') as l_dir then if attached separate_character_option_value ('d') as l_dir then
log.write_debug (generator + ".cms_setup using a command line argument -d " + l_dir ) log.write_debug (generator + ".cms_setup using a command line argument -d " + l_dir )
@@ -135,11 +135,11 @@ feature -- CMS setup
do do
create {BASIC_AUTH_MODULE} m.make create {BASIC_AUTH_MODULE} m.make
m.enable m.enable
a_setup.available_modules.extend (m) a_setup.register_module (m)
create {CMS_DEMO_MODULE} m.make create {CMS_DEMO_MODULE} m.make
m.enable m.enable
a_setup.available_modules.extend (m) a_setup.register_module (m)
end end
setup_storage (a_setup: CMS_SETUP) setup_storage (a_setup: CMS_SETUP)

View File

@@ -2,7 +2,7 @@
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-13-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-13-0 http://www.eiffel.com/developers/xml/configuration-1-13-0.xsd" name="persistence_sqlite" uuid="8FD9D3B3-5FC1-495F-A05D-0205EC966841" library_target="persistence_sqlite"> <system xmlns="http://www.eiffel.com/developers/xml/configuration-1-13-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-13-0 http://www.eiffel.com/developers/xml/configuration-1-13-0.xsd" name="persistence_sqlite" uuid="8FD9D3B3-5FC1-495F-A05D-0205EC966841" library_target="persistence_sqlite">
<target name="persistence_sqlite"> <target name="persistence_sqlite">
<root all_classes="true"/> <root all_classes="true"/>
<option warning="true" void_safety="all"> <option warning="true" void_safety="none">
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/> <assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
</option> </option>
<setting name="console_application" value="true"/> <setting name="console_application" value="true"/>

View File

@@ -1,7 +1,9 @@
note note
description: "Summary description for {CMS_DEFAULT_SETUP}." description: "[
date: "$Date$" Default CMS_SETUP that can be reused easily, and/or redefined to match specific setup.
revision: "$Revision$" ]"
date: "$Date: 2014-11-19 20:00:19 +0100 (mer., 19 nov. 2014) $"
revision: "$Revision: 96123 $"
class class
CMS_DEFAULT_SETUP CMS_DEFAULT_SETUP
@@ -10,6 +12,7 @@ inherit
CMS_SETUP CMS_SETUP
REFACTORING_HELPER REFACTORING_HELPER
create create
make make
@@ -24,10 +27,10 @@ feature {NONE} -- Initialization
end end
initialize initialize
-- Initialize varius cms components. -- Initialize various cms components.
do do
configure configure
create available_modules.make (3) create modules.make (3)
build_mailer build_mailer
initialize_modules initialize_modules
end end
@@ -57,20 +60,20 @@ feature {NONE} -- Initialization
-- -- Core -- -- Core
-- create {USER_MODULE} m.make (Current) -- create {USER_MODULE} m.make (Current)
-- m.enable -- m.enable
-- modules.extend (m) -- register_module (m)
-- create {ADMIN_MODULE} m.make (Current) -- create {ADMIN_MODULE} m.make (Current)
-- m.enable -- m.enable
-- modules.extend (m) -- register_module (m)
create {NODE_MODULE} m.make (Current) create {NODE_MODULE} m.make (Current)
m.enable m.enable
available_modules.extend (m) register_module (m)
end end
feature -- Access feature -- Access
available_modules: CMS_MODULE_COLLECTION modules: CMS_MODULE_COLLECTION
-- <Precursor> -- <Precursor>
is_html: BOOLEAN is_html: BOOLEAN
@@ -96,6 +99,14 @@ feature -- Access
to_implement ("Not implemented mailer") to_implement ("Not implemented mailer")
end end
feature -- Element change
register_module (m: CMS_MODULE)
-- <Precursor>
do
modules.extend (m)
end
feature -- Compute location feature -- Compute location
compute_theme_location compute_theme_location

View File

@@ -24,19 +24,14 @@ feature -- Access
deferred deferred
end end
available_modules: CMS_MODULE_COLLECTION
-- List of available modules.
deferred
end
enabled_modules: CMS_MODULE_COLLECTION enabled_modules: CMS_MODULE_COLLECTION
-- List of enabled modules. -- List of enabled modules.
local local
l_module: CMS_MODULE l_module: CMS_MODULE
do do
create Result.make (available_modules.count) create Result.make (modules.count)
across across
available_modules as ic modules as ic
loop loop
l_module := ic.item l_module := ic.item
if l_module.is_enabled then if l_module.is_enabled then
@@ -47,9 +42,18 @@ feature -- Access
only_enabled_modules: across Result as ic all ic.item.is_enabled end only_enabled_modules: across Result as ic all ic.item.is_enabled end
end end
feature {CMS_MODULE} -- Restricted access
modules: CMS_MODULE_COLLECTION
-- List of available modules.
deferred
end
feature -- Access: Site feature -- Access: Site
site_id: READABLE_STRING_8 site_id: READABLE_STRING_8
-- String identifying current CMS.
-- This could be used in webform, for cookie name, ...
site_name: READABLE_STRING_32 site_name: READABLE_STRING_32
-- Name of the site. -- Name of the site.
@@ -70,13 +74,13 @@ feature -- Access: Theme
-- Path to themes. -- Path to themes.
theme_location: PATH theme_location: PATH
-- Path to a particular theme. -- Path to a active theme.
theme_assets_location: PATH theme_assets_location: PATH
-- Path to a particular theme assets folder. -- Path to a active theme assets folder.
theme_information_location: PATH theme_information_location: PATH
-- theme informations. -- Active theme informations.
do do
Result := theme_location.extended ("theme.info") Result := theme_location.extended ("theme.info")
end end
@@ -84,4 +88,13 @@ feature -- Access: Theme
theme_name: READABLE_STRING_32 theme_name: READABLE_STRING_32
-- theme name. -- theme name.
feature -- Element change
register_module (m: CMS_MODULE)
-- Add module `m' to `modules'
deferred
ensure
module_added: modules.has (m)
end
end end