Added notion of CMS_CONTENT as ancestor of CMS_NODE.
Moved CMS_CONTENT_TYPE to core library.
Added basic and limited taxonomy query /taxonomy/term/{termid} .
This commit is contained in:
@@ -83,6 +83,7 @@ feature -- Conversion
|
||||
Result := content
|
||||
end
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
|
||||
@@ -43,6 +43,8 @@ feature {NONE} -- Initialize
|
||||
do
|
||||
-- Initialize formats.
|
||||
initialize_formats
|
||||
-- Initialize contents.
|
||||
initialize_content_types
|
||||
|
||||
-- Initialize storage.
|
||||
if attached setup.storage (error_handler) as l_storage then
|
||||
@@ -88,6 +90,12 @@ feature {NONE} -- Initialize
|
||||
end
|
||||
end
|
||||
|
||||
initialize_content_types
|
||||
-- Initialize content types.
|
||||
do
|
||||
create content_types.make (1)
|
||||
end
|
||||
|
||||
initialize_formats
|
||||
-- Initialize content formats.
|
||||
local
|
||||
@@ -156,6 +164,32 @@ feature -- Access
|
||||
storage: CMS_STORAGE
|
||||
-- Default persistence storage.
|
||||
|
||||
feature -- Content
|
||||
|
||||
content_types: ARRAYED_LIST [CMS_CONTENT_TYPE]
|
||||
-- Available content types
|
||||
|
||||
add_content_type (a_type: CMS_CONTENT_TYPE)
|
||||
-- Register content type `a_type'.
|
||||
do
|
||||
content_types.force (a_type)
|
||||
end
|
||||
|
||||
content_type (a_name: READABLE_STRING_GENERAL): detachable CMS_CONTENT_TYPE
|
||||
-- Content type named `a_named' if any.
|
||||
do
|
||||
across
|
||||
content_types as ic
|
||||
until
|
||||
Result /= Void
|
||||
loop
|
||||
Result := ic.item
|
||||
if not a_name.is_case_insensitive_equal (Result.name) then
|
||||
Result := Void
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Formats
|
||||
|
||||
formats: CMS_FORMATS
|
||||
|
||||
66
src/service/content/cms_content.e
Normal file
66
src/service/content/cms_content.e
Normal file
@@ -0,0 +1,66 @@
|
||||
note
|
||||
description: "[
|
||||
Abstract of entity managed by CMS.
|
||||
]"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
CMS_CONTENT
|
||||
|
||||
inherit
|
||||
DEBUG_OUTPUT
|
||||
|
||||
feature -- Access
|
||||
|
||||
title: detachable READABLE_STRING_32
|
||||
-- Title associated with Current content.
|
||||
deferred
|
||||
end
|
||||
|
||||
content_type: READABLE_STRING_8
|
||||
-- Associated content type name.
|
||||
-- Page, Article, Blog, News, etc.
|
||||
deferred
|
||||
end
|
||||
|
||||
format: detachable READABLE_STRING_8
|
||||
-- Format associated with `content' and `summary'.
|
||||
-- For example: text, mediawiki, html, etc
|
||||
deferred
|
||||
end
|
||||
|
||||
link: detachable CMS_LOCAL_LINK
|
||||
-- Associated menu link.
|
||||
deferred
|
||||
end
|
||||
|
||||
feature -- Status report
|
||||
|
||||
is_typed_as (a_content_type: READABLE_STRING_GENERAL): BOOLEAN
|
||||
-- Is current node of type `a_content_type' ?
|
||||
do
|
||||
Result := a_content_type.is_case_insensitive_equal (content_type)
|
||||
end
|
||||
|
||||
feature -- Status report
|
||||
|
||||
debug_output: STRING_32
|
||||
-- <Precursor>
|
||||
do
|
||||
create Result.make_empty
|
||||
Result.append_character ('<')
|
||||
Result.append_string_general (content_type)
|
||||
Result.append_character ('>')
|
||||
if attached title as l_title then
|
||||
Result.append_character (' ')
|
||||
Result.append_character ('%"')
|
||||
Result.append (l_title)
|
||||
Result.append_character ('%"')
|
||||
end
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
end
|
||||
92
src/service/content/cms_content_type.e
Normal file
92
src/service/content/cms_content_type.e
Normal file
@@ -0,0 +1,92 @@
|
||||
note
|
||||
description: "[
|
||||
Interface defining a CMS content type.
|
||||
]"
|
||||
status: "draft"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
CMS_CONTENT_TYPE
|
||||
|
||||
inherit
|
||||
CMS_API_ACCESS
|
||||
|
||||
feature -- Access
|
||||
|
||||
name: READABLE_STRING_8
|
||||
-- Internal name.
|
||||
deferred
|
||||
end
|
||||
|
||||
title: READABLE_STRING_32
|
||||
-- Human readable name.
|
||||
deferred
|
||||
end
|
||||
|
||||
description: detachable READABLE_STRING_32
|
||||
-- Optional description
|
||||
deferred
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
available_formats: LIST [CONTENT_FORMAT]
|
||||
-- Available formats for Current type.
|
||||
deferred
|
||||
end
|
||||
|
||||
format (a_name: READABLE_STRING_8): detachable CONTENT_FORMAT
|
||||
-- Format named `a_name', if available.
|
||||
do
|
||||
across
|
||||
available_formats as ic
|
||||
until
|
||||
Result /= Void
|
||||
loop
|
||||
Result := ic.item
|
||||
if not a_name.is_case_insensitive_equal (Result.name) then
|
||||
Result := Void
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Element change
|
||||
|
||||
extend_format (f: CONTENT_FORMAT)
|
||||
-- Add `f' to the list of `available_formats'
|
||||
require
|
||||
not_has_format: format (f.name) = Void
|
||||
do
|
||||
available_formats.extend (f)
|
||||
ensure
|
||||
format_added: format (f.name) /= Void
|
||||
end
|
||||
|
||||
remove_format (f: CONTENT_FORMAT)
|
||||
-- Add `f' to the list of `available_formats'
|
||||
local
|
||||
lst: like available_formats
|
||||
l_name: READABLE_STRING_GENERAL
|
||||
do
|
||||
from
|
||||
l_name := f.name
|
||||
lst := available_formats
|
||||
lst.start
|
||||
until
|
||||
lst.after
|
||||
loop
|
||||
if l_name.is_case_insensitive_equal (lst.item.name) then
|
||||
lst.remove
|
||||
else
|
||||
lst.forth
|
||||
end
|
||||
end
|
||||
ensure
|
||||
format_removed: format (f.name) = Void
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2015, Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
end
|
||||
73
src/service/content/cms_partial_content.e
Normal file
73
src/service/content/cms_partial_content.e
Normal file
@@ -0,0 +1,73 @@
|
||||
note
|
||||
description: "[
|
||||
Instance of CMS_CONTENT representing the minimal information
|
||||
for a CMS_CONTENT.
|
||||
]"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CMS_PARTIAL_CONTENT
|
||||
|
||||
inherit
|
||||
CMS_CONTENT
|
||||
|
||||
create
|
||||
make_empty
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make_empty (a_content_type: READABLE_STRING_8)
|
||||
require
|
||||
type_not_blank: not a_content_type.is_whitespace
|
||||
do
|
||||
content_type := a_content_type
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
title: detachable READABLE_STRING_32
|
||||
-- Title associated with Current content.
|
||||
|
||||
content_type: READABLE_STRING_8
|
||||
-- Associated content type name.
|
||||
-- Page, Article, Blog, News, etc.
|
||||
|
||||
format: detachable READABLE_STRING_8
|
||||
-- Format associated with `content' and `summary'.
|
||||
-- For example: text, mediawiki, html, etc
|
||||
|
||||
link: detachable CMS_LOCAL_LINK
|
||||
-- Associated menu link.
|
||||
|
||||
feature -- Element change
|
||||
|
||||
set_title (a_title: detachable READABLE_STRING_GENERAL)
|
||||
do
|
||||
if a_title = Void then
|
||||
title := Void
|
||||
else
|
||||
create {STRING_32} title.make_from_string_general (a_title)
|
||||
end
|
||||
end
|
||||
|
||||
set_format (a_format: like format)
|
||||
-- Assign `format' with `a_format'.
|
||||
do
|
||||
format := a_format
|
||||
ensure
|
||||
format_assigned: format = a_format
|
||||
end
|
||||
|
||||
set_link (a_link: like link)
|
||||
-- Assign `link' with `a_link'.
|
||||
do
|
||||
link := a_link
|
||||
ensure
|
||||
link_assigned: link = a_link
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
end
|
||||
Reference in New Issue
Block a user