From 134f876e622af32e3d2fcc85c306fa07bd92f644 Mon Sep 17 00:00:00 2001 From: Jocelyn Fiat Date: Tue, 28 Mar 2017 22:26:21 +0200 Subject: [PATCH] Display the full url for uploaded files via the CMS_FILES_MODULE. Keep db/mails in checkout. --- examples/demo/site/db/mails/README.md | 1 + modules/files/cms_files_module.e | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 examples/demo/site/db/mails/README.md diff --git a/examples/demo/site/db/mails/README.md b/examples/demo/site/db/mails/README.md new file mode 100644 index 0000000..4be5133 --- /dev/null +++ b/examples/demo/site/db/mails/README.md @@ -0,0 +1 @@ +This directory can be used to keep emails sent by the CMS. diff --git a/modules/files/cms_files_module.e b/modules/files/cms_files_module.e index 8f64d5d..b48c3a5 100644 --- a/modules/files/cms_files_module.e +++ b/modules/files/cms_files_module.e @@ -97,7 +97,7 @@ feature -- Access: router do map_uri_template_agent (a_router, "/" + uploads_location, agent execute_upload (?, ?, a_api), Void) -- Accepts any method GET, HEAD, POST, PUT, DELETE, ... map_uri_template_agent (a_router, "/" + uploads_location + "{filename}", agent display_uploaded_file_info (?, ?, a_api), a_router.methods_get) - map_uri_template_agent (a_router, "/" + uploads_location + "remove/{filename}", agent remove_file (?, ?, a_api), a_router.methods_get) + map_uri_template_agent (a_router, "/" + uploads_location + "{filename}/remove", agent remove_file (?, ?, a_api), a_router.methods_get) end uploads_location: STRING = "upload/" @@ -133,6 +133,7 @@ feature -- Handler local body: STRING_8 r: CMS_RESPONSE + l_file_url: STRING_8 f: CMS_FILE md: detachable CMS_FILE_METADATA fn: READABLE_STRING_32 @@ -193,12 +194,18 @@ feature -- Handler else body.append ("NA") end + body.append ("
%N") + + --| File Url + l_file_url := req.script_url ("/" + l_files_api.file_link (f).location) + body.append ("File URL: ") + body.append (l_file_url) body.append ("

%N") - body.append ("Download%N") - body.append ("Remove%N") + body.append ("Download%N") + body.append ("Remove%N") body.append ("%N") -- metadata - + body.append ("
%N") body.append ("
") if attached f.relative_path.extension as ext and then @@ -425,7 +432,7 @@ feature -- Handler -- add remove button a_output.append ("") - a_output.append ("Remove%N") + a_output.append ("Remove%N") a_output.append ("%N") a_output.append ("%N")