Extracted page support from cms_node_module, and add a proper CMS_PAGE_MODULE.

- now, the CMS_PAGE_MODULE has to be declared in the related CMS_SETUP via CMS_EXECUTION.
   (See demo for example)

Improved the export facilities.
  Implemented blog and page export.
Added import facilities.
  Implemented blog and page import.

Improved node revision web interface (allow to edit a past revision, in order to restore it as latest revisionm i.e current).
Removed specific tag from blog module, and reuse the taxonomy module for that purpose.

Added WIKITEXT module that provide a WIKITEXT_FILTER, so now we can have wikitext content.
   - for now, no support for wiki links such as [[Foobar]].
This commit is contained in:
2017-01-20 16:05:40 +01:00
parent 3bcfb0a44a
commit 2d698f604b
59 changed files with 1761 additions and 679 deletions

View File

@@ -234,7 +234,7 @@ feature -- Hook: export
subscribe_to_hook (h, {CMS_HOOK_EXPORT})
end
invoke_export_to (a_export_id_list: detachable ITERABLE [READABLE_STRING_GENERAL]; a_export_parameters: CMS_EXPORT_PARAMETERS; a_response: CMS_RESPONSE)
invoke_export_to (a_export_id_list: detachable ITERABLE [READABLE_STRING_GENERAL]; a_export_parameters: CMS_EXPORT_CONTEXT; a_response: CMS_RESPONSE)
-- Invoke response alter hook for response `a_response'.
local
d: DIRECTORY
@@ -254,7 +254,36 @@ feature -- Hook: export
end
end
feature -- Hook: import
subscribe_to_import_hook (h: CMS_HOOK_IMPORT)
-- Add `h' as subscriber of import hooks CMS_HOOK_IMPORT.
do
subscribe_to_hook (h, {CMS_HOOK_IMPORT})
end
invoke_import_from (a_import_id_list: detachable ITERABLE [READABLE_STRING_GENERAL]; a_import_ctx: CMS_IMPORT_CONTEXT; a_response: CMS_RESPONSE)
-- Invoke response alter hook for response `a_response'.
local
d: DIRECTORY
do
if attached subscribers ({CMS_HOOK_IMPORT}) as lst then
create d.make_with_path (a_import_ctx.location)
if not d.exists then
d.recursive_create_dir
end
across
lst as ic
loop
if attached {CMS_HOOK_IMPORT} ic.item as h then
h.import_from (a_import_id_list, a_import_ctx, a_response)
end
end
end
end
note
copyright: "2011-2016, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
copyright: "2011-2017, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
end

View File

@@ -6,7 +6,7 @@ note
revision: "$Revision$"
class
CMS_EXPORT_PARAMETERS
CMS_EXPORT_CONTEXT
create
make

View File

@@ -13,19 +13,19 @@ inherit
feature -- Hook
export_to (a_export_id_list: detachable ITERABLE [READABLE_STRING_GENERAL]; a_export_parameters: CMS_EXPORT_PARAMETERS; a_response: CMS_RESPONSE)
export_to (a_export_id_list: detachable ITERABLE [READABLE_STRING_GENERAL]; a_export_ctx: CMS_EXPORT_CONTEXT; a_response: CMS_RESPONSE)
-- Export data identified by `a_export_id_list',
-- or export all data if `a_export_id_list' is Void.
deferred
end
-- export_identifiers: detachable ITERABLE [READABLE_STRING_32]
-- export_identifiers: detachable ITERABLE [READABLE_STRING_GENERAL]
-- -- Optional list of exportation ids, if any.
-- do
-- -- To redefine if needed.
-- end
note
copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
copyright: "2011-2017, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
end

View File

@@ -0,0 +1,23 @@
note
description: "Summary description for {CMS_HOOK_IMPORT}."
date: "$Date$"
revision: "$Revision$"
deferred class
CMS_HOOK_IMPORT
inherit
CMS_HOOK
feature -- Hook
import_from (a_impot_id_list: detachable ITERABLE [READABLE_STRING_GENERAL]; a_import_ctx: CMS_IMPORT_CONTEXT; a_response: CMS_RESPONSE)
-- Import data identified by `a_import_id_list',
-- or import all data if `a_import_id_list' is Void.
deferred
end
note
copyright: "2011-2017, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
end

View File

@@ -0,0 +1,43 @@
note
description: "[
Parameters used by CMS_HOOK_IMPORT subscribers.
]"
date: "$Date$"
revision: "$Revision$"
class
CMS_IMPORT_CONTEXT
create
make
feature {NONE} -- Initialization
make (a_location: PATH)
do
location := a_location
create logs.make (10)
end
feature -- Access
location: PATH
-- Location of import folder.
feature -- Logs
logs: ARRAYED_LIST [READABLE_STRING_8]
-- Associated importation logs.
log (m: READABLE_STRING_8)
-- Add message `m' into `logs'.
do
logs.force (m)
end
invariant
note
copyright: "2011-2017, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
end

View File

@@ -0,0 +1,57 @@
note
description: "[
Usefull routines to import to JSON.
]"
date: "$Date$"
revision: "$Revision$"
class
CMS_IMPORT_JSON_UTILITIES
feature -- Access
json_string_item (j: JSON_OBJECT; a_name: READABLE_STRING_GENERAL): detachable STRING_32
do
if attached {JSON_STRING} j.item (a_name) as s then
Result := s.unescaped_string_32
end
end
json_string_8_item (j: JSON_OBJECT; a_name: READABLE_STRING_GENERAL): detachable STRING_8
do
if attached {JSON_STRING} j.item (a_name) as s then
Result := s.unescaped_string_8
end
end
json_integer_item (j: JSON_OBJECT; a_name: READABLE_STRING_GENERAL): INTEGER_64
local
s: READABLE_STRING_GENERAL
do
if attached {JSON_NUMBER} j.item (a_name) as i then
Result := i.integer_64_item
elseif attached {JSON_STRING} j.item (a_name) as js then
s := js.unescaped_string_32
if s.is_integer_64 then
Result := s.to_integer_64
end
end
end
json_date_item (j: JSON_OBJECT; a_name: READABLE_STRING_GENERAL): detachable DATE_TIME
local
hd: HTTP_DATE
do
if attached {JSON_NUMBER} j.item (a_name) as num then
create hd.make_from_timestamp (num.integer_64_item)
Result := hd.date_time
elseif attached {JSON_STRING} j.item (a_name) as s then
create hd.make_from_string (s.unescaped_string_32)
Result := hd.date_time
end
end
note
copyright: "2011-2017, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
end

View File

@@ -38,7 +38,7 @@ feature -- Access
password: Result /= Void implies (Result.hashed_password /= Void and Result.password = Void)
end
user_by_name (a_name: like {CMS_USER}.name): detachable CMS_USER
user_by_name (a_name: READABLE_STRING_GENERAL): detachable CMS_USER
-- User with name `a_name', if any.
require
a_name /= Void and then not a_name.is_empty
@@ -284,6 +284,6 @@ feature -- New Temp User
note
copyright: "2011-2016, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
copyright: "2011-2017, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
end

View File

@@ -77,7 +77,7 @@ feature -- Access: user
sql_finalize
end
user_by_name (a_name: like {CMS_USER}.name): detachable CMS_USER
user_by_name (a_name: READABLE_STRING_GENERAL): detachable CMS_USER
-- User for the given name `a_name', if any.
local
l_parameters: STRING_TABLE [detachable ANY]
@@ -1347,6 +1347,6 @@ feature {NONE} -- SQL select
note
copyright: "2011-2016, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
copyright: "2011-2017, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
end

View File

@@ -804,7 +804,7 @@ feature -- Environment/ modules and theme
feature -- Hook
export_to (a_export_id_list: detachable ITERABLE [READABLE_STRING_GENERAL]; a_export_parameters: CMS_EXPORT_PARAMETERS; a_response: CMS_RESPONSE)
export_to (a_export_id_list: detachable ITERABLE [READABLE_STRING_GENERAL]; a_export_ctx: CMS_EXPORT_CONTEXT; a_response: CMS_RESPONSE)
-- <Precursor>.
local
p: PATH
@@ -816,14 +816,14 @@ feature -- Hook
do
if attached a_response.has_permissions (<<"admin export", "export core">>) then
if a_export_id_list = Void then -- Include everything
p := a_export_parameters.location.extended ("core")
p := a_export_ctx.location.extended ("core")
create d.make_with_path (p)
if not d.exists then
d.recursive_create_dir
end
-- path_aliases export.
a_export_parameters.log ("Exporting path_aliases")
a_export_ctx.log ("Exporting path_aliases")
create jo.make_empty
across storage.path_aliases as ic loop
jo.put_string (ic.item, ic.key)
@@ -835,7 +835,7 @@ feature -- Hook
-- custom_values export.
if attached storage.custom_values as lst then
a_export_parameters.log ("Exporting custom_values")
a_export_ctx.log ("Exporting custom_values")
create ja.make_empty
across
lst as ic
@@ -857,7 +857,7 @@ feature -- Hook
end
-- users export.
a_export_parameters.log ("Exporting users")
a_export_ctx.log ("Exporting users")
create jo.make_empty
create jobj.make_empty
@@ -1016,7 +1016,7 @@ feature {NONE} -- Implementation: current user
end
note
copyright: "2011-2016, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
copyright: "2011-2017, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
end

View File

@@ -264,19 +264,9 @@ feature -- Filters
setup_filter
-- Setup `filter'.
local
f: WSF_FILTER
do
api.logger.put_debug (generator + ".setup_filter", Void)
from
f := filter
until
not attached f.next as l_next
loop
f := l_next
end
f.set_next (Current)
append_filter (Current)
end
feature -- Execution
@@ -331,7 +321,7 @@ feature -- Execution
end
note
copyright: "2011-2016, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
copyright: "2011-2017, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software

View File

@@ -22,7 +22,7 @@ feature -- Access: user
Result := storage.user_by_id (a_id)
end
user_by_name (a_username: READABLE_STRING_32): detachable CMS_USER
user_by_name (a_username: READABLE_STRING_GENERAL): detachable CMS_USER
-- User by name `a_user_name', if any.
do
Result := storage.user_by_name (a_username)
@@ -407,6 +407,6 @@ feature -- Change Temp User
end
note
copyright: "2011-2016, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
copyright: "2011-2017, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
end