Moved library/src to src
This commit is contained in:
97
src/kernel/cms_common_api.e
Normal file
97
src/kernel/cms_common_api.e
Normal file
@@ -0,0 +1,97 @@
|
||||
note
|
||||
description: "Summary description for {WSF_CMS_COMMON_API}."
|
||||
author: ""
|
||||
date: "$Date: 2014-11-13 16:23:47 +0100 (jeu., 13 nov. 2014) $"
|
||||
revision: "$Revision: 96085 $"
|
||||
|
||||
deferred class
|
||||
CMS_COMMON_API
|
||||
|
||||
inherit
|
||||
WSF_API_UTILITIES
|
||||
|
||||
feature {NONE} -- Access
|
||||
|
||||
site_url: READABLE_STRING_8
|
||||
do
|
||||
Result := ""
|
||||
end
|
||||
|
||||
base_url: detachable READABLE_STRING_8
|
||||
-- Base url if any.
|
||||
do
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
user_link (u: CMS_USER): like link
|
||||
do
|
||||
Result := link (u.name, "/user/" + u.id.out, Void)
|
||||
end
|
||||
|
||||
node_link (n: CMS_NODE): like link
|
||||
do
|
||||
Result := link (n.title, "/node/" + n.id.out, Void)
|
||||
end
|
||||
|
||||
user_url (u: CMS_USER): like url
|
||||
do
|
||||
Result := url ("/user/" + u.id.out, Void)
|
||||
end
|
||||
|
||||
node_url (n: CMS_NODE): like url
|
||||
do
|
||||
Result := url ("/node/" + n.id.out, Void)
|
||||
end
|
||||
|
||||
feature -- Helper
|
||||
|
||||
is_empty (s: detachable READABLE_STRING_GENERAL): BOOLEAN
|
||||
-- Is `s' is Void or empty ?
|
||||
do
|
||||
Result := s = Void or else s.is_empty
|
||||
end
|
||||
|
||||
unix_timestamp (dt: DATE_TIME): INTEGER_64
|
||||
do
|
||||
Result := (create {HTTP_DATE_TIME_UTILITIES}).unix_time_stamp (dt)
|
||||
end
|
||||
|
||||
unix_timestamp_to_date_time (t: INTEGER_64): DATE_TIME
|
||||
do
|
||||
Result := (create {HTTP_DATE_TIME_UTILITIES}).unix_time_stamp_to_date_time (t)
|
||||
end
|
||||
|
||||
string_unix_timestamp_to_date_time (s: READABLE_STRING_8): DATE_TIME
|
||||
do
|
||||
if s.is_integer_64 then
|
||||
Result := (create {HTTP_DATE_TIME_UTILITIES}).unix_time_stamp_to_date_time (s.to_integer_64)
|
||||
else
|
||||
Result := (create {HTTP_DATE_TIME_UTILITIES}).unix_time_stamp_to_date_time (0)
|
||||
end
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
options_boolean (opts: HASH_TABLE [detachable ANY, STRING]; k: STRING; dft: BOOLEAN): BOOLEAN
|
||||
do
|
||||
if attached {BOOLEAN} opts.item (k) as h then
|
||||
Result := h
|
||||
else
|
||||
Result := dft
|
||||
end
|
||||
end
|
||||
|
||||
options_string (opts: HASH_TABLE [detachable ANY, STRING]; k: STRING): detachable STRING
|
||||
do
|
||||
if attached {STRING} opts.item (k) as s then
|
||||
Result := s
|
||||
end
|
||||
end
|
||||
|
||||
-- html_encoder: HTML_ENCODER
|
||||
-- once ("thread")
|
||||
-- create Result
|
||||
-- end
|
||||
|
||||
end
|
||||
38
src/kernel/content/cms_block.e
Normal file
38
src/kernel/content/cms_block.e
Normal file
@@ -0,0 +1,38 @@
|
||||
note
|
||||
description: "Describe content to be placed inside Regions."
|
||||
date: "$Date: 2014-11-17 18:47:30 +0100 (lun., 17 nov. 2014) $"
|
||||
|
||||
deferred class
|
||||
CMS_BLOCK
|
||||
|
||||
feature -- Access
|
||||
|
||||
name: READABLE_STRING_8
|
||||
-- Name identifying Current block.
|
||||
deferred
|
||||
end
|
||||
|
||||
title: detachable READABLE_STRING_32
|
||||
-- Optional title.
|
||||
deferred
|
||||
end
|
||||
|
||||
feature -- status report
|
||||
|
||||
is_enabled: BOOLEAN
|
||||
-- Is current block enabled?
|
||||
|
||||
is_raw: BOOLEAN
|
||||
-- Is raw?
|
||||
-- If True, do not get wrapped it with block specific div
|
||||
deferred
|
||||
end
|
||||
|
||||
feature -- Conversion
|
||||
|
||||
to_html (a_theme: CMS_THEME): STRING_8
|
||||
-- HTML representation of Current block.
|
||||
deferred
|
||||
end
|
||||
|
||||
end
|
||||
42
src/kernel/content/cms_block_region.e
Normal file
42
src/kernel/content/cms_block_region.e
Normal file
@@ -0,0 +1,42 @@
|
||||
note
|
||||
description: "Summary description for {CMS_BLOCK_REGION}."
|
||||
date: "$Date: 2014-11-13 16:23:47 +0100 (jeu., 13 nov. 2014) $"
|
||||
|
||||
class
|
||||
CMS_BLOCK_REGION
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_name: like name)
|
||||
do
|
||||
name := a_name
|
||||
create blocks.make (1)
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
name: READABLE_STRING_8
|
||||
|
||||
blocks: ARRAYED_LIST [CMS_BLOCK]
|
||||
|
||||
feature -- Element change
|
||||
|
||||
extend (b: CMS_BLOCK)
|
||||
do
|
||||
blocks.force (b)
|
||||
end
|
||||
|
||||
;note
|
||||
copyright: "2011-2014, Jocelyn Fiat, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
96
src/kernel/content/cms_content_block.e
Normal file
96
src/kernel/content/cms_content_block.e
Normal file
@@ -0,0 +1,96 @@
|
||||
note
|
||||
description: "CMS_BLOCK implemented with a `content' associated with a specific `format'."
|
||||
date: "$Date: 2014-11-18 10:13:13 +0100 (mar., 18 nov. 2014) $"
|
||||
revision: "$Revision: 96110 $"
|
||||
|
||||
class
|
||||
CMS_CONTENT_BLOCK
|
||||
|
||||
inherit
|
||||
CMS_BLOCK
|
||||
|
||||
create
|
||||
make,
|
||||
make_raw
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_name: like name; a_title: like title; a_content: like content; a_format: like format)
|
||||
require
|
||||
a_name_not_blank: not a_name.is_whitespace
|
||||
do
|
||||
is_enabled := True
|
||||
name := a_name
|
||||
title := a_title
|
||||
content := a_content
|
||||
format := a_format
|
||||
end
|
||||
|
||||
make_raw (a_name: like name; a_title: like title; a_content: like content; a_format: like format)
|
||||
require
|
||||
a_name_not_blank: not a_name.is_whitespace
|
||||
do
|
||||
make (a_name, a_title, a_content, a_format)
|
||||
set_is_raw (True)
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
name: READABLE_STRING_8
|
||||
|
||||
title: detachable READABLE_STRING_32
|
||||
|
||||
content: READABLE_STRING_8
|
||||
|
||||
format: detachable CONTENT_FORMAT
|
||||
|
||||
feature -- Status report
|
||||
|
||||
is_raw: BOOLEAN
|
||||
-- Is raw?
|
||||
-- If True, do not get wrapped it with block specific div
|
||||
|
||||
feature -- Element change
|
||||
|
||||
set_is_raw (b: BOOLEAN)
|
||||
do
|
||||
is_raw := b
|
||||
end
|
||||
|
||||
set_name (n: like name)
|
||||
-- Set `name' to `n'.
|
||||
require
|
||||
not n.is_whitespace
|
||||
do
|
||||
name := n
|
||||
end
|
||||
|
||||
set_title (a_title: like title)
|
||||
-- Set `title' to `a_title'.
|
||||
do
|
||||
title := a_title
|
||||
end
|
||||
|
||||
feature -- Conversion
|
||||
|
||||
to_html (a_theme: CMS_THEME): STRING_8
|
||||
do
|
||||
-- Why in this particular case theme is not used to generate the content?
|
||||
|
||||
if attached format as f then
|
||||
Result := f.formatted_output (content)
|
||||
else
|
||||
Result := content
|
||||
end
|
||||
end
|
||||
note
|
||||
copyright: "2011-2014, Jocelyn Fiat, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
35
src/kernel/content/cms_encoders.e
Normal file
35
src/kernel/content/cms_encoders.e
Normal file
@@ -0,0 +1,35 @@
|
||||
note
|
||||
description: "Summary description for {CMS_ENCODERS}."
|
||||
author: ""
|
||||
date: "$Date: 2014-11-13 16:23:47 +0100 (jeu., 13 nov. 2014) $"
|
||||
revision: "$Revision: 96085 $"
|
||||
|
||||
class
|
||||
CMS_ENCODERS
|
||||
|
||||
feature -- Encoders
|
||||
|
||||
url_encoded (s: detachable READABLE_STRING_GENERAL): STRING_8
|
||||
local
|
||||
enc: URL_ENCODER
|
||||
do
|
||||
create enc
|
||||
if s /= Void then
|
||||
Result := enc.general_encoded_string (s)
|
||||
else
|
||||
create Result.make_empty
|
||||
end
|
||||
end
|
||||
|
||||
html_encoded (s: detachable READABLE_STRING_GENERAL): STRING_8
|
||||
local
|
||||
enc: HTML_ENCODER
|
||||
do
|
||||
create enc
|
||||
if s /= Void then
|
||||
Result := enc.general_encoded_string (s)
|
||||
else
|
||||
create Result.make_empty
|
||||
end
|
||||
end
|
||||
end
|
||||
148
src/kernel/content/cms_file_block.e
Normal file
148
src/kernel/content/cms_file_block.e
Normal file
@@ -0,0 +1,148 @@
|
||||
note
|
||||
description: "[
|
||||
CMS block with file content.
|
||||
]"
|
||||
date: "$Date: 2014-12-05 22:39:27 +0100 (ven., 05 déc. 2014) $"
|
||||
revision: "$Revision: 96260 $"
|
||||
|
||||
class
|
||||
CMS_FILE_BLOCK
|
||||
|
||||
inherit
|
||||
CMS_BLOCK
|
||||
redefine
|
||||
out
|
||||
end
|
||||
|
||||
create
|
||||
make,
|
||||
make_raw
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_name: like name; a_title: like title; a_files_root_path: detachable PATH; a_file_location: PATH)
|
||||
-- Create Current with `a_name', `a_title', `a_file_location'
|
||||
-- inside root directory `a_files_root_path' for the files.
|
||||
require
|
||||
a_name_not_blank: not a_name.is_whitespace
|
||||
do
|
||||
is_enabled := True
|
||||
name := a_name
|
||||
title := a_title
|
||||
location := a_file_location
|
||||
root_path := a_files_root_path
|
||||
end
|
||||
|
||||
make_raw (a_name: like name; a_title: like title; a_files_root_path: PATH; a_file_location: PATH)
|
||||
-- Create Current with `a_name', `a_title', `a_file_location'
|
||||
-- inside root directory `a_files_root_path' for the files.
|
||||
require
|
||||
a_name_not_blank: not a_name.is_whitespace
|
||||
do
|
||||
make (a_name, a_title, a_files_root_path, a_file_location)
|
||||
set_is_raw (True)
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
name: READABLE_STRING_8
|
||||
-- <Precursor>
|
||||
|
||||
title: detachable READABLE_STRING_32
|
||||
-- <Precursor>
|
||||
|
||||
location: PATH
|
||||
-- Location of file.
|
||||
|
||||
root_path: detachable PATH
|
||||
-- Root location for files universe.
|
||||
|
||||
feature -- Status report
|
||||
|
||||
is_raw: BOOLEAN
|
||||
-- Is raw?
|
||||
-- If True, do not get wrapped it with block specific div
|
||||
|
||||
feature -- Element change
|
||||
|
||||
set_is_raw (b: BOOLEAN)
|
||||
do
|
||||
is_raw := b
|
||||
end
|
||||
|
||||
set_name (n: like name)
|
||||
-- Set `name' to `n'.
|
||||
require
|
||||
not n.is_whitespace
|
||||
do
|
||||
name := n
|
||||
end
|
||||
|
||||
set_title (a_title: like title)
|
||||
-- Set `title' to `a_title'.
|
||||
do
|
||||
title := a_title
|
||||
end
|
||||
|
||||
feature -- Conversion
|
||||
|
||||
to_html (a_theme: CMS_THEME): STRING_8
|
||||
-- <Precursor>
|
||||
local
|
||||
p: detachable PATH
|
||||
f: RAW_FILE
|
||||
ut: FILE_UTILITIES
|
||||
do
|
||||
-- Process html generation
|
||||
if attached root_path as l_root_path then
|
||||
p := l_root_path.extended_path (location)
|
||||
else
|
||||
p := location
|
||||
end
|
||||
if ut.file_path_exists (p) then
|
||||
create f.make_with_path (p)
|
||||
if f.exists and then f.is_access_readable then
|
||||
create Result.make (f.count)
|
||||
f.open_read
|
||||
from
|
||||
until
|
||||
f.end_of_file or f.exhausted
|
||||
loop
|
||||
f.read_stream_thread_aware (1_024)
|
||||
Result.append (f.last_string)
|
||||
end
|
||||
f.close
|
||||
else
|
||||
Result := ""
|
||||
debug ("cms")
|
||||
Result := "File block #" + name
|
||||
end
|
||||
end
|
||||
else
|
||||
Result := ""
|
||||
debug ("cms")
|
||||
Result := "File block #" + name
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Debug
|
||||
|
||||
out: STRING
|
||||
do
|
||||
create Result.make_from_string (generator)
|
||||
Result.append ("%Nname:")
|
||||
Result.append (name)
|
||||
if attached title as l_title then
|
||||
Result.append ("%N%Ttitle:")
|
||||
Result.append (l_title)
|
||||
end
|
||||
Result.append ("%Nlocation:")
|
||||
Result.append (location.out)
|
||||
if attached root_path as l_root_path then
|
||||
Result.append ("%Nroot_path:")
|
||||
Result.append (l_root_path.out)
|
||||
end
|
||||
Result.append ("%N")
|
||||
end
|
||||
end
|
||||
62
src/kernel/content/cms_menu_block.e
Normal file
62
src/kernel/content/cms_menu_block.e
Normal file
@@ -0,0 +1,62 @@
|
||||
note
|
||||
description: "Summary description for {CMS_MENU_BLOCK}."
|
||||
date: "$Date: 2014-11-14 20:11:17 +0100 (ven., 14 nov. 2014) $"
|
||||
|
||||
class
|
||||
CMS_MENU_BLOCK
|
||||
|
||||
inherit
|
||||
CMS_BLOCK
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_menu: like menu)
|
||||
do
|
||||
is_enabled := True
|
||||
menu := a_menu
|
||||
name := a_menu.name
|
||||
title := a_menu.title
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
menu: CMS_MENU
|
||||
|
||||
name: READABLE_STRING_8
|
||||
|
||||
title: detachable READABLE_STRING_32
|
||||
|
||||
feature -- Status report
|
||||
|
||||
is_horizontal: BOOLEAN
|
||||
|
||||
is_raw: BOOLEAN = False
|
||||
-- <Precursor>
|
||||
|
||||
feature -- Element change
|
||||
|
||||
set_name (n: like name)
|
||||
-- Set `name' to `n'.
|
||||
require
|
||||
not n.is_whitespace
|
||||
do
|
||||
name := n
|
||||
end
|
||||
|
||||
set_title (a_title: like title)
|
||||
-- Set `title' to `a_title'.
|
||||
do
|
||||
title := a_title
|
||||
end
|
||||
|
||||
feature -- Conversion
|
||||
|
||||
to_html (a_theme: CMS_THEME): STRING_8
|
||||
do
|
||||
Result := a_theme.menu_html (menu, is_horizontal)
|
||||
end
|
||||
|
||||
end
|
||||
195
src/kernel/content/cms_smarty_template_block.e
Normal file
195
src/kernel/content/cms_smarty_template_block.e
Normal file
@@ -0,0 +1,195 @@
|
||||
note
|
||||
description: "[
|
||||
CMS block with smarty template file content.
|
||||
]"
|
||||
date: "$Date: 2014-12-05 22:39:27 +0100 (ven., 05 déc. 2014) $"
|
||||
revision: "$Revision: 96260 $"
|
||||
|
||||
class
|
||||
CMS_SMARTY_TEMPLATE_BLOCK
|
||||
|
||||
inherit
|
||||
CMS_BLOCK
|
||||
redefine
|
||||
out
|
||||
select
|
||||
out
|
||||
end
|
||||
SHARED_TEMPLATE_CONTEXT
|
||||
rename
|
||||
out as tpl_out
|
||||
end
|
||||
|
||||
create
|
||||
make,
|
||||
make_raw
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_name: like name; a_title: like title; a_template_root_path: PATH; a_template_location: PATH)
|
||||
-- Create Current with `a_name', `a_title', `a_template_location'
|
||||
-- inside root directory `a_template_root_path' for the templates.
|
||||
require
|
||||
a_name_not_blank: not a_name.is_whitespace
|
||||
do
|
||||
is_enabled := True
|
||||
name := a_name
|
||||
title := a_title
|
||||
location := a_template_location
|
||||
template_root_path := a_template_root_path
|
||||
create values.make (0)
|
||||
end
|
||||
|
||||
make_raw (a_name: like name; a_title: like title; a_template_root_path: PATH; a_template_location: PATH)
|
||||
-- Create Current with `a_name', `a_title', `a_template_location'
|
||||
-- inside root directory `a_template_root_path' for the templates.
|
||||
require
|
||||
a_name_not_blank: not a_name.is_whitespace
|
||||
do
|
||||
make (a_name, a_title, a_template_root_path, a_template_location)
|
||||
set_is_raw (True)
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
name: READABLE_STRING_8
|
||||
-- <Precursor>
|
||||
|
||||
title: detachable READABLE_STRING_32
|
||||
-- <Precursor>
|
||||
|
||||
location: PATH
|
||||
-- Location of template file.
|
||||
|
||||
template_root_path: PATH
|
||||
-- Root location for templates universe.
|
||||
|
||||
values: STRING_TABLE [detachable ANY]
|
||||
-- Additional value used during template output processing.
|
||||
|
||||
feature -- Status report
|
||||
|
||||
is_raw: BOOLEAN
|
||||
-- Is raw?
|
||||
-- If True, do not get wrapped it with block specific div
|
||||
|
||||
feature -- Element change
|
||||
|
||||
set_is_raw (b: BOOLEAN)
|
||||
do
|
||||
is_raw := b
|
||||
end
|
||||
|
||||
set_name (n: like name)
|
||||
-- Set `name' to `n'.
|
||||
require
|
||||
not n.is_whitespace
|
||||
do
|
||||
name := n
|
||||
end
|
||||
|
||||
set_title (a_title: like title)
|
||||
-- Set `title' to `a_title'.
|
||||
do
|
||||
title := a_title
|
||||
end
|
||||
|
||||
set_value (v: detachable ANY; k: READABLE_STRING_GENERAL)
|
||||
-- Associate value `v' with key `k'.
|
||||
do
|
||||
values.force (v, k)
|
||||
end
|
||||
|
||||
unset_value (k: READABLE_STRING_GENERAL)
|
||||
-- Remove value indexed by key `k'.
|
||||
do
|
||||
values.remove (k)
|
||||
end
|
||||
|
||||
feature -- Conversion
|
||||
|
||||
to_html (a_theme: CMS_THEME): STRING_8
|
||||
-- <Precursor>
|
||||
local
|
||||
p: detachable PATH
|
||||
tpl: detachable TEMPLATE_FILE
|
||||
ut: FILE_UTILITIES
|
||||
n: STRING_32
|
||||
l_table_inspector: detachable STRING_TABLE_OF_STRING_INSPECTOR
|
||||
do
|
||||
-- Process html generation
|
||||
p := location
|
||||
if ut.file_path_exists (template_root_path.extended_path (p)) then
|
||||
n := p.name
|
||||
template_context.set_template_folder (template_root_path)
|
||||
template_context.disable_verbose
|
||||
debug ("cms")
|
||||
template_context.enable_verbose
|
||||
end
|
||||
|
||||
create tpl.make_from_file (n)
|
||||
|
||||
across
|
||||
values as ic
|
||||
loop
|
||||
tpl.add_value (ic.item, ic.key)
|
||||
end
|
||||
|
||||
|
||||
create l_table_inspector.register (({detachable STRING_TABLE [STRING_8]}).name)
|
||||
create l_table_inspector.register (({detachable STRING_TABLE [STRING_32]}).name)
|
||||
create l_table_inspector.register (({detachable STRING_TABLE [READABLE_STRING_8]}).name)
|
||||
create l_table_inspector.register (({detachable STRING_TABLE [READABLE_STRING_32]}).name)
|
||||
tpl.analyze
|
||||
tpl.get_output
|
||||
l_table_inspector.unregister
|
||||
-- l_table32_inspector.unregister
|
||||
|
||||
if attached tpl.output as l_output then
|
||||
Result := l_output
|
||||
else
|
||||
Result := ""
|
||||
debug ("cms")
|
||||
Result := "Template block #" + name
|
||||
end
|
||||
end
|
||||
else
|
||||
Result := ""
|
||||
debug ("cms")
|
||||
Result := "Template block #" + name
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Debug
|
||||
|
||||
out: STRING
|
||||
do
|
||||
create Result.make_from_string (generator)
|
||||
Result.append ("%Nname:")
|
||||
Result.append (name)
|
||||
if attached title as l_title then
|
||||
Result.append ("%N%Ttitle:")
|
||||
Result.append (l_title)
|
||||
end
|
||||
Result.append ("%Nlocation:")
|
||||
Result.append (location.out)
|
||||
Result.append ("%Ntemplate_root_path:")
|
||||
Result.append (template_root_path.out)
|
||||
Result.append ("%NValues: {")
|
||||
from
|
||||
values.start
|
||||
until
|
||||
values.after
|
||||
loop
|
||||
Result.append ("%NKey:")
|
||||
Result.append (values.key_for_iteration.as_string_8)
|
||||
Result.append (" - Value:")
|
||||
if attached values.item_for_iteration as l_item then
|
||||
Result.append (l_item.out)
|
||||
end
|
||||
values.forth
|
||||
end
|
||||
Result.append ("%N}")
|
||||
end
|
||||
end
|
||||
92
src/kernel/content/cms_value_table.e
Normal file
92
src/kernel/content/cms_value_table.e
Normal file
@@ -0,0 +1,92 @@
|
||||
note
|
||||
description: "[
|
||||
Object containing a collection of values.
|
||||
It is typically used by `{CMS_RESPONSE}.values' .
|
||||
]"
|
||||
date: "$Date: 2014-11-13 16:23:47 +0100 (jeu., 13 nov. 2014) $"
|
||||
revision: "$Revision: 96085 $"
|
||||
|
||||
class
|
||||
CMS_VALUE_TABLE
|
||||
|
||||
inherit
|
||||
TABLE_ITERABLE [detachable ANY, READABLE_STRING_GENERAL]
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (nb: INTEGER)
|
||||
do
|
||||
create table.make (nb)
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
count: INTEGER
|
||||
-- Number of items.
|
||||
do
|
||||
Result := table.count
|
||||
end
|
||||
|
||||
item (key: READABLE_STRING_GENERAL): detachable ANY
|
||||
-- Item associated with `key', if present
|
||||
-- otherwise default value of type `G'.
|
||||
note
|
||||
option: stable
|
||||
do
|
||||
Result := table.item (key)
|
||||
end
|
||||
|
||||
has (key: READABLE_STRING_GENERAL): BOOLEAN
|
||||
-- Has item associated with key `key'?
|
||||
do
|
||||
Result := table.has (key)
|
||||
end
|
||||
|
||||
new_cursor: TABLE_ITERATION_CURSOR [detachable ANY, READABLE_STRING_GENERAL]
|
||||
-- <Precursor>
|
||||
do
|
||||
Result := table.new_cursor
|
||||
end
|
||||
|
||||
feature -- Element change
|
||||
|
||||
put (new: detachable ANY; key: READABLE_STRING_GENERAL)
|
||||
-- Insert `new' with `key' if there is no other item
|
||||
-- associated with the same key.
|
||||
do
|
||||
table.put (new, key)
|
||||
end
|
||||
|
||||
force (new: detachable ANY; key: READABLE_STRING_GENERAL)
|
||||
-- Update table so that `new' will be the item associated
|
||||
-- with `key'.
|
||||
do
|
||||
table.force (new, key)
|
||||
end
|
||||
|
||||
remove (key: READABLE_STRING_GENERAL)
|
||||
do
|
||||
table.remove (key)
|
||||
end
|
||||
|
||||
feature {NONE} -- Duplication
|
||||
|
||||
table: STRING_TABLE [detachable ANY]
|
||||
|
||||
invariant
|
||||
table_set: table /= Void
|
||||
|
||||
note
|
||||
copyright: "2011-2014, Jocelyn Fiat, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
64
src/kernel/content/format/cms_formats.e
Normal file
64
src/kernel/content/format/cms_formats.e
Normal file
@@ -0,0 +1,64 @@
|
||||
note
|
||||
description: "Summary description for {CMS_FORMATS}."
|
||||
author: ""
|
||||
date: "$Date: 2014-11-13 16:23:47 +0100 (jeu., 13 nov. 2014) $"
|
||||
revision: "$Revision: 96085 $"
|
||||
|
||||
class
|
||||
CMS_FORMATS
|
||||
|
||||
feature -- Access
|
||||
|
||||
format (a_name: like {CONTENT_FORMAT}.name): detachable CONTENT_FORMAT
|
||||
do
|
||||
across
|
||||
all_formats as c
|
||||
until
|
||||
Result /= Void
|
||||
loop
|
||||
if c.item.name.same_string (a_name) then
|
||||
Result := c.item
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
all_formats: LIST [CONTENT_FORMAT]
|
||||
once
|
||||
create {ARRAYED_LIST [CONTENT_FORMAT]} Result.make (3)
|
||||
Result.force (plain_text)
|
||||
Result.force (full_html)
|
||||
Result.force (filtered_html)
|
||||
end
|
||||
|
||||
default_format: CONTENT_FORMAT
|
||||
do
|
||||
Result := plain_text --FIXME
|
||||
end
|
||||
|
||||
plain_text: PLAIN_TEXT_CONTENT_FORMAT
|
||||
once
|
||||
create Result
|
||||
end
|
||||
|
||||
full_html: FULL_HTML_CONTENT_FORMAT
|
||||
once
|
||||
create Result
|
||||
end
|
||||
|
||||
filtered_html: FILTERED_HTML_CONTENT_FORMAT
|
||||
once
|
||||
create Result
|
||||
end
|
||||
|
||||
|
||||
note
|
||||
copyright: "2011-2014, Jocelyn Fiat, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
5949 Hollister Ave., Goleta, CA 93117 USA
|
||||
Telephone 805-685-1006, Fax 805-685-6869
|
||||
Website http://www.eiffel.com
|
||||
Customer support http://support.eiffel.com
|
||||
]"
|
||||
end
|
||||
42
src/kernel/form/cms_form.e
Normal file
42
src/kernel/form/cms_form.e
Normal file
@@ -0,0 +1,42 @@
|
||||
note
|
||||
description: "Summary description for {CMS_FORM}."
|
||||
date: "$Date: 2014-11-13 16:23:47 +0100 (jeu., 13 nov. 2014) $"
|
||||
revision: "$Revision: 96085 $"
|
||||
|
||||
class
|
||||
CMS_FORM
|
||||
|
||||
inherit
|
||||
WSF_FORM
|
||||
rename
|
||||
process as process_form
|
||||
end
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature -- Basic operation
|
||||
|
||||
prepare (a_response: CMS_RESPONSE)
|
||||
do
|
||||
a_response.invoke_form_alter (Current, Void)
|
||||
end
|
||||
|
||||
process (a_response: CMS_RESPONSE)
|
||||
do
|
||||
process_form (a_response.request, agent on_prepared (a_response, ?), agent on_processed (a_response, ?))
|
||||
end
|
||||
|
||||
on_prepared (a_response: CMS_RESPONSE; fd: WSF_FORM_DATA)
|
||||
do
|
||||
a_response.invoke_form_alter (Current, fd)
|
||||
end
|
||||
|
||||
on_processed (a_response: CMS_RESPONSE; fd: WSF_FORM_DATA)
|
||||
do
|
||||
if not fd.is_valid or fd.has_error then
|
||||
a_response.report_form_errors (fd)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
104
src/kernel/link/cms_menu_system.e
Normal file
104
src/kernel/link/cms_menu_system.e
Normal file
@@ -0,0 +1,104 @@
|
||||
note
|
||||
description: "[
|
||||
Menu associated with CMS system.
|
||||
]"
|
||||
date: "$Date: 2014-11-13 16:23:47 +0100 (jeu., 13 nov. 2014) $"
|
||||
revision: "$Revision: 96085 $"
|
||||
|
||||
class
|
||||
CMS_MENU_SYSTEM
|
||||
|
||||
inherit
|
||||
ITERABLE [CMS_MENU]
|
||||
|
||||
REFACTORING_HELPER
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
-- Create a predefined manu system
|
||||
do
|
||||
to_implement ("Refactor, take the info from a Database or Configuration file.")
|
||||
create items.make (5)
|
||||
force (create {CMS_MENU}.make ("primary", 3))
|
||||
force (create {CMS_MENU}.make_with_title ("management", "Management", 3))
|
||||
force (create {CMS_MENU}.make_with_title ("secondary", "Navigation", 3))
|
||||
force (create {CMS_MENU}.make_with_title ("user", "User", 3))
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
item (n: like {CMS_MENU}.name): CMS_MENU
|
||||
-- Menu associated with name `n',
|
||||
-- if none, it is created.
|
||||
local
|
||||
m: detachable CMS_MENU
|
||||
do
|
||||
m := items.item (n)
|
||||
if m = Void then
|
||||
create m.make (n, 3)
|
||||
force (m)
|
||||
end
|
||||
Result := m
|
||||
end
|
||||
|
||||
main_menu: CMS_MENU
|
||||
obsolete
|
||||
"Use `primary_menu' [Nov/2014]"
|
||||
do
|
||||
Result := primary_menu
|
||||
end
|
||||
|
||||
primary_menu: CMS_MENU
|
||||
do
|
||||
Result := item ("primary")
|
||||
end
|
||||
|
||||
secondary_menu: CMS_MENU
|
||||
do
|
||||
Result := item ("secondary")
|
||||
end
|
||||
|
||||
management_menu: CMS_MENU
|
||||
do
|
||||
Result := item ("management")
|
||||
end
|
||||
|
||||
navigation_menu: CMS_MENU
|
||||
do
|
||||
Result := item ("navigation")
|
||||
end
|
||||
|
||||
user_menu: CMS_MENU
|
||||
do
|
||||
Result := item ("user")
|
||||
end
|
||||
|
||||
primary_tabs: CMS_MENU
|
||||
do
|
||||
Result := item ("primary-tabs")
|
||||
end
|
||||
|
||||
feature -- Change
|
||||
|
||||
force (m: CMS_MENU)
|
||||
-- Add menu `m'.
|
||||
do
|
||||
items.force (m, m.name)
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
new_cursor: ITERATION_CURSOR [CMS_MENU]
|
||||
-- Fresh cursor associated with current structure.
|
||||
do
|
||||
Result := items.new_cursor
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
items: STRING_TABLE [CMS_MENU]
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user