- 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]].
122 lines
2.9 KiB
Plaintext
122 lines
2.9 KiB
Plaintext
note
|
|
description: "[
|
|
Administrate import functionality.
|
|
]"
|
|
date: "$Date$"
|
|
revision: "$Revision$"
|
|
|
|
class
|
|
CMS_ADMIN_IMPORT_HANDLER
|
|
|
|
inherit
|
|
CMS_HANDLER
|
|
|
|
WSF_URI_HANDLER
|
|
rename
|
|
new_mapping as new_uri_mapping
|
|
end
|
|
|
|
WSF_RESOURCE_HANDLER_HELPER
|
|
redefine
|
|
do_get,
|
|
do_post
|
|
end
|
|
|
|
REFACTORING_HELPER
|
|
|
|
create
|
|
make
|
|
|
|
feature -- Execution
|
|
|
|
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
|
-- Execute request handler
|
|
do
|
|
execute_methods (req, res)
|
|
end
|
|
|
|
do_get (req: WSF_REQUEST; res: WSF_RESPONSE)
|
|
local
|
|
l_response: CMS_RESPONSE
|
|
s: STRING
|
|
f: CMS_FORM
|
|
do
|
|
create {GENERIC_VIEW_CMS_RESPONSE} l_response.make (req, res, api)
|
|
f := importation_web_form (l_response)
|
|
create s.make_empty
|
|
f.append_to_html (l_response.wsf_theme, s)
|
|
l_response.set_main_content (s)
|
|
l_response.execute
|
|
end
|
|
|
|
do_post (req: WSF_REQUEST; res: WSF_RESPONSE)
|
|
local
|
|
l_response: CMS_RESPONSE
|
|
s: STRING
|
|
f: CMS_FORM
|
|
l_importation: CMS_IMPORT_CONTEXT
|
|
p: PATH
|
|
do
|
|
create {GENERIC_VIEW_CMS_RESPONSE} l_response.make (req, res, api)
|
|
f := importation_web_form (l_response)
|
|
f.process (l_response)
|
|
if
|
|
attached f.last_data as fd and then
|
|
fd.is_valid
|
|
then
|
|
if attached fd.string_item ("op") as l_op and then l_op.same_string (text_import_all_data) then
|
|
if attached fd.string_item ("folder") as l_folder then
|
|
create p.make_from_string (l_folder)
|
|
if p.is_absolute then
|
|
create l_importation.make (p)
|
|
else
|
|
create l_importation.make (api.site_location.extended ("import").extended (l_folder))
|
|
end
|
|
else
|
|
create l_importation.make (api.site_location.extended ("import").extended ("default"))
|
|
end
|
|
api.hooks.invoke_import_from (Void, l_importation, l_response)
|
|
l_response.add_notice_message ("All data imported (if allowed)!")
|
|
create s.make_empty
|
|
across
|
|
l_importation.logs as ic
|
|
loop
|
|
s.append (ic.item)
|
|
s.append ("<br/>")
|
|
s.append_character ('%N')
|
|
end
|
|
l_response.add_notice_message (s)
|
|
else
|
|
fd.report_error ("Invalid form data!")
|
|
end
|
|
end
|
|
create s.make_empty
|
|
f.append_to_html (l_response.wsf_theme, s)
|
|
l_response.set_main_content (s)
|
|
l_response.execute
|
|
end
|
|
|
|
feature -- Widget
|
|
|
|
importation_web_form (a_response: CMS_RESPONSE): CMS_FORM
|
|
local
|
|
f_name: WSF_FORM_TEXT_INPUT
|
|
but: WSF_FORM_SUBMIT_INPUT
|
|
do
|
|
create Result.make (a_response.url (a_response.location, Void), "import_all_data")
|
|
Result.extend_raw_text ("Import CMS data from ")
|
|
create f_name.make_with_text ("folder", "default")
|
|
f_name.set_label ("Import folder name")
|
|
f_name.set_description ("Folder name under 'imports' folder.")
|
|
f_name.set_is_required (True)
|
|
Result.extend (f_name)
|
|
create but.make_with_text ("op", text_import_all_data)
|
|
Result.extend (but)
|
|
end
|
|
|
|
feature -- Interface text.
|
|
|
|
text_import_all_data: STRING_32 = "Import all data"
|
|
|
|
end
|