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
cms_setup: CMS_CUSTOM_SETUP
cms_setup: CMS_DEFAULT_SETUP
do
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 )
@@ -135,11 +135,11 @@ feature -- CMS setup
do
create {BASIC_AUTH_MODULE} m.make
m.enable
a_setup.available_modules.extend (m)
a_setup.register_module (m)
create {CMS_DEMO_MODULE} m.make
m.enable
a_setup.available_modules.extend (m)
a_setup.register_module (m)
end
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">
<target name="persistence_sqlite">
<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"/>
</option>
<setting name="console_application" value="true"/>

View File

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

View File

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