Configuration File added

Created CMS_BLOG_CONFIG at moved the feature entries_per_page to this new class. The blog hander inherits from the config class
This commit is contained in:
Dario Bösch
2015-05-22 11:30:54 +02:00
parent fb196735b6
commit 1f61126d22
3 changed files with 33 additions and 18 deletions

View File

@@ -0,0 +1,21 @@
note
description: "Configuration class for the blog module."
author: "Dario B<>sch <daboesch@student.ethz.ch"
date: "$Date: 2015-05-22 11:26:00 +0100$"
revision: "$Revision: 96616 $"
class
CMS_BLOG_CONFIG
feature {BLOG_HANDLER}-- Configuration of blog handler
entries_per_page : INTEGER
-- The numbers of posts that are shown on one page. If there are more post a pagination is generated
do
-- For test reasons this is 2, so we don't have to create a lot of blog entries.
-- TODO: Set to bigger constant.
Result := 2
end
end

View File

@@ -8,6 +8,8 @@ class
BLOG_HANDLER BLOG_HANDLER
inherit inherit
CMS_BLOG_CONFIG
CMS_BLOG_HANDLER CMS_BLOG_HANDLER
WSF_URI_HANDLER WSF_URI_HANDLER
@@ -54,20 +56,6 @@ feature -- execute
execute (req, res) execute (req, res)
end end
feature -- Settings
entries_per_page : INTEGER
-- The numbers of posts that are shown on one page. If there are more post a pagination is generated
do
-- For test reasons this is 2, so we don't have to create a lot of blog entries.
-- TODO: Set to bigger constant or load from global configuration file.
Result := 2
end
more_than_one_page : BOOLEAN
-- Checks if all posts fit on one page (FALSE) or if more than one page is needed (TRUE)
do
Result := entries_per_page < node_api.blogs_count
end
feature -- HTTP Methods feature -- HTTP Methods
do_get (req: WSF_REQUEST; res: WSF_RESPONSE) do_get (req: WSF_REQUEST; res: WSF_RESPONSE)
@@ -163,6 +151,12 @@ feature -- HTTP Methods
feature -- Query feature -- Query
more_than_one_page : BOOLEAN
-- Checks if all posts fit on one page (FALSE) or if more than one page is needed (TRUE)
do
Result := entries_per_page < node_api.blogs_count
end
page_number_path_parameter (req: WSF_REQUEST): NATURAL_16 page_number_path_parameter (req: WSF_REQUEST): NATURAL_16
-- Returns the page number from the path /blogs/{page}. It's an unsigned integere since negative pages are not allowed -- Returns the page number from the path /blogs/{page}. It's an unsigned integere since negative pages are not allowed
local local

View File

@@ -1,8 +1,8 @@
note note
description: "Summary description for {CMS_BLOG_STORAGE_SQL}." description: "Access to the sql database for the blog module"
author: "" author: "Dario B<>sch <daboesch@student.ethz.ch>"
date: "$Date$" date: "$Date: 2015-05-21 14:46:00 +0100$"
revision: "$Revision$" revision: "$Revision: 96616 $"
class class
CMS_BLOG_STORAGE_SQL CMS_BLOG_STORAGE_SQL