Added refactoring helper class to add comments.
This commit is contained in:
@@ -143,7 +143,7 @@ feature -- Blocks initialization
|
|||||||
|
|
||||||
-- FIXME: let the user choose ...
|
-- FIXME: let the user choose ...
|
||||||
create l_table.make_caseless (10)
|
create l_table.make_caseless (10)
|
||||||
l_table["page_top"] := "top"
|
l_table["top"] := "top"
|
||||||
l_table["header"] := "header"
|
l_table["header"] := "header"
|
||||||
l_table["highlighted"] := "highlighted"
|
l_table["highlighted"] := "highlighted"
|
||||||
l_table["help"] := "help"
|
l_table["help"] := "help"
|
||||||
@@ -152,7 +152,7 @@ feature -- Blocks initialization
|
|||||||
l_table["management"] := "first_sidebar"
|
l_table["management"] := "first_sidebar"
|
||||||
l_table["navigation"] := "first_sidebar"
|
l_table["navigation"] := "first_sidebar"
|
||||||
l_table["user"] := "first_sidebar"
|
l_table["user"] := "first_sidebar"
|
||||||
l_table["page_bottom"] := "page_bottom"
|
l_table["bottom"] := "page_bottom"
|
||||||
block_region_settings := l_table
|
block_region_settings := l_table
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -275,13 +275,13 @@ feature -- Blocks
|
|||||||
local
|
local
|
||||||
s: STRING
|
s: STRING
|
||||||
do
|
do
|
||||||
fixme ("Avoid Hardcoded HTML")
|
fixme ("Avoid Hardcoded HTML!!!")
|
||||||
-- create s.make_from_string ("<a href=%""+ url ("/", Void) +"%"><img id=%"logo%" src=%"" + logo_location + "%"/></a><div id=%"title%">" + html_encoded (site_name) + "</div>")
|
-- create s.make_from_string ("<a href=%""+ url ("/", Void) +"%"><img id=%"logo%" src=%"" + logo_location + "%"/></a><div id=%"title%">" + html_encoded (site_name) + "</div>")
|
||||||
create s.make_empty
|
create s.make_empty
|
||||||
s.append ("<div id=%"menu-bar%">")
|
s.append ("<div id=%"menu-bar%">")
|
||||||
s.append (theme.menu_html (main_menu, True))
|
s.append (theme.menu_html (main_menu, True))
|
||||||
s.append ("</div>")
|
s.append ("</div>")
|
||||||
create Result.make ("top_header", Void, s, formats.full_html)
|
create Result.make ("header", Void, s, formats.full_html)
|
||||||
Result.set_is_raw (True)
|
Result.set_is_raw (True)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
note
|
note
|
||||||
description: "Summary description for {CMS_HTML_PAGE}."
|
description: "Summary description for {CMS_HTML_PAGE}."
|
||||||
date: "$Date$"
|
author: ""
|
||||||
revision: "$Revision$"
|
date: "$Date: 2014-11-04 09:57:24 -0300 (ma. 04 de nov. de 2014) $"
|
||||||
|
revision: "$Revision: 96034 $"
|
||||||
|
|
||||||
class
|
class
|
||||||
CMS_HTML_PAGE
|
CMS_HTML_PAGE
|
||||||
@@ -23,6 +24,7 @@ feature {NONE} -- Initialization
|
|||||||
do
|
do
|
||||||
create regions.make (5)
|
create regions.make (5)
|
||||||
language := "en"
|
language := "en"
|
||||||
|
|
||||||
status_code := {HTTP_STATUS_CODE}.ok
|
status_code := {HTTP_STATUS_CODE}.ok
|
||||||
create header.make
|
create header.make
|
||||||
create {ARRAYED_LIST [STRING]} head_lines.make (5)
|
create {ARRAYED_LIST [STRING]} head_lines.make (5)
|
||||||
@@ -65,7 +67,7 @@ feature -- Header
|
|||||||
|
|
||||||
feature -- Region
|
feature -- Region
|
||||||
|
|
||||||
regions: HASH_TABLE [STRING_8, STRING_8]
|
regions: STRING_TABLE [STRING_8]
|
||||||
-- header
|
-- header
|
||||||
-- content
|
-- content
|
||||||
-- footer
|
-- footer
|
||||||
@@ -83,21 +85,6 @@ feature -- Region
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
header_region: STRING_8
|
|
||||||
do
|
|
||||||
Result := region ("header")
|
|
||||||
end
|
|
||||||
|
|
||||||
content_region: STRING_8
|
|
||||||
do
|
|
||||||
Result := region ("content")
|
|
||||||
end
|
|
||||||
|
|
||||||
footer_region: STRING_8
|
|
||||||
do
|
|
||||||
Result := region ("content")
|
|
||||||
end
|
|
||||||
|
|
||||||
feature -- Element change
|
feature -- Element change
|
||||||
|
|
||||||
register_variable (a_value: detachable ANY; k: READABLE_STRING_GENERAL)
|
register_variable (a_value: detachable ANY; k: READABLE_STRING_GENERAL)
|
||||||
@@ -118,41 +105,11 @@ feature -- Element change
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
add_to_header_region (s: STRING)
|
|
||||||
do
|
|
||||||
add_to_region (s, "header")
|
|
||||||
end
|
|
||||||
|
|
||||||
add_to_content_region (s: STRING)
|
|
||||||
do
|
|
||||||
add_to_region (s, "content")
|
|
||||||
end
|
|
||||||
|
|
||||||
add_to_footer_region (s: STRING)
|
|
||||||
do
|
|
||||||
add_to_region (s, "footer")
|
|
||||||
end
|
|
||||||
|
|
||||||
set_region (s: STRING; k: STRING)
|
set_region (s: STRING; k: STRING)
|
||||||
do
|
do
|
||||||
regions.force (s, k)
|
regions.force (s, k)
|
||||||
end
|
end
|
||||||
|
|
||||||
set_header_region (s: STRING)
|
|
||||||
do
|
|
||||||
set_region (s, "header")
|
|
||||||
end
|
|
||||||
|
|
||||||
set_content_region (s: STRING)
|
|
||||||
do
|
|
||||||
set_region (s, "content")
|
|
||||||
end
|
|
||||||
|
|
||||||
set_footer_region (s: STRING)
|
|
||||||
do
|
|
||||||
set_region (s, "footer")
|
|
||||||
end
|
|
||||||
|
|
||||||
feature -- Element change
|
feature -- Element change
|
||||||
|
|
||||||
set_status_code (c: like status_code)
|
set_status_code (c: like status_code)
|
||||||
@@ -170,6 +127,50 @@ feature -- Element change
|
|||||||
title := s
|
title := s
|
||||||
end
|
end
|
||||||
|
|
||||||
|
add_meta_name_content (a_name: STRING; a_content: STRING)
|
||||||
|
local
|
||||||
|
s: STRING_8
|
||||||
|
do
|
||||||
|
s := "<meta name=%"" + a_name + "%" content=%"" + a_content + "%" />"
|
||||||
|
head_lines.extend (s)
|
||||||
|
end
|
||||||
|
|
||||||
|
add_meta_http_equiv (a_http_equiv: STRING; a_content: STRING)
|
||||||
|
local
|
||||||
|
s: STRING_8
|
||||||
|
do
|
||||||
|
s := "<meta http-equiv=%"" + a_http_equiv + "%" content=%"" + a_content + "%" />"
|
||||||
|
head_lines.extend (s)
|
||||||
|
end
|
||||||
|
|
||||||
|
add_style (a_href: STRING; a_media: detachable STRING)
|
||||||
|
local
|
||||||
|
s: STRING_8
|
||||||
|
do
|
||||||
|
s := "<link rel=%"stylesheet%" href=%""+ a_href + "%" type=%"text/css%""
|
||||||
|
if a_media /= Void then
|
||||||
|
s.append (" media=%""+ a_media + "%"")
|
||||||
|
end
|
||||||
|
s.append ("/>")
|
||||||
|
head_lines.extend (s)
|
||||||
|
end
|
||||||
|
|
||||||
|
add_javascript_url (a_src: STRING)
|
||||||
|
local
|
||||||
|
s: STRING_8
|
||||||
|
do
|
||||||
|
s := "<script type=%"text/javascript%" src=%"" + a_src + "%"></script>"
|
||||||
|
head_lines.extend (s)
|
||||||
|
end
|
||||||
|
|
||||||
|
add_javascript_content (a_script: STRING)
|
||||||
|
local
|
||||||
|
s: STRING_8
|
||||||
|
do
|
||||||
|
s := "<script type=%"text/javascript%">%N" + a_script + "%N</script>"
|
||||||
|
head_lines.extend (s)
|
||||||
|
end
|
||||||
|
|
||||||
note
|
note
|
||||||
copyright: "2011-2014, Jocelyn Fiat, Eiffel Software and others"
|
copyright: "2011-2014, Jocelyn Fiat, Eiffel Software and others"
|
||||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
|
|||||||
@@ -1,12 +1,16 @@
|
|||||||
note
|
note
|
||||||
description: "Summary description for {WSF_CMS_THEME}."
|
description: "Summary description for {WSF_CMS_THEME}."
|
||||||
author: ""
|
|
||||||
date: "$Date$"
|
date: "$Date$"
|
||||||
revision: "$Revision$"
|
revision: "$Revision$"
|
||||||
|
|
||||||
deferred class
|
deferred class
|
||||||
CMS_THEME
|
CMS_THEME
|
||||||
|
|
||||||
|
inherit
|
||||||
|
|
||||||
|
REFACTORING_HELPER
|
||||||
|
|
||||||
|
|
||||||
feature {NONE} -- Access
|
feature {NONE} -- Access
|
||||||
|
|
||||||
setup: CMS_SETUP
|
setup: CMS_SETUP
|
||||||
@@ -14,16 +18,20 @@ feature {NONE} -- Access
|
|||||||
feature -- Access
|
feature -- Access
|
||||||
|
|
||||||
name: STRING
|
name: STRING
|
||||||
|
-- theme name.
|
||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
regions: ARRAY [STRING]
|
regions: ARRAY [STRING]
|
||||||
|
-- theme's regions.
|
||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
page_template: CMS_TEMPLATE
|
page_template: CMS_TEMPLATE
|
||||||
|
-- theme template page.
|
||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Conversion
|
feature -- Conversion
|
||||||
|
|
||||||
menu_html (a_menu: CMS_MENU; is_horizontal: BOOLEAN): STRING_8
|
menu_html (a_menu: CMS_MENU; is_horizontal: BOOLEAN): STRING_8
|
||||||
@@ -33,6 +41,7 @@ feature -- Conversion
|
|||||||
end
|
end
|
||||||
|
|
||||||
block_html (a_block: CMS_BLOCK): STRING_8
|
block_html (a_block: CMS_BLOCK): STRING_8
|
||||||
|
-- Render a block as HTML.
|
||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -47,6 +56,7 @@ feature {NONE} -- Implementation
|
|||||||
local
|
local
|
||||||
cl: STRING
|
cl: STRING
|
||||||
do
|
do
|
||||||
|
fixme ("Remove HTML from Eiffel")
|
||||||
create cl.make_empty
|
create cl.make_empty
|
||||||
if lnk.is_active then
|
if lnk.is_active then
|
||||||
cl.append ("active ")
|
cl.append ("active ")
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ feature {NONE} -- Initialization
|
|||||||
create items.make_caseless (1)
|
create items.make_caseless (1)
|
||||||
create regions.make (5)
|
create regions.make (5)
|
||||||
across
|
across
|
||||||
(<<"header", "content", "footer", "first_sidebar", "second_sidebar">>) as ic
|
(<<"top","header", "highlighted","help", "content", "footer", "first_sidebar", "second_sidebar", "bottom">>) as ic
|
||||||
loop
|
loop
|
||||||
regions.force (ic.item, ic.item)
|
regions.force (ic.item, ic.item)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ feature -- Access
|
|||||||
across
|
across
|
||||||
theme.regions as r
|
theme.regions as r
|
||||||
loop
|
loop
|
||||||
variables.force (page.region (r.item), r.item)
|
variables.force (page.region (r.item), "region_" + r.item)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -10,8 +10,6 @@ class
|
|||||||
inherit
|
inherit
|
||||||
CMS_THEME
|
CMS_THEME
|
||||||
|
|
||||||
REFACTORING_HELPER
|
|
||||||
|
|
||||||
create
|
create
|
||||||
make
|
make
|
||||||
|
|
||||||
@@ -82,15 +80,43 @@ feature -- Conversion
|
|||||||
-- Render Menu as HTML.
|
-- Render Menu as HTML.
|
||||||
-- A theme will define a menu.tpl
|
-- A theme will define a menu.tpl
|
||||||
do
|
do
|
||||||
to_implement ("Add implementation")
|
create Result.make_from_string ("<div id=%""+ a_menu.name +"%" class=%"menu%">")
|
||||||
Result := "to be implemented"
|
if is_horizontal then
|
||||||
|
Result.append ("<ul class=%"horizontal%" >%N")
|
||||||
|
else
|
||||||
|
Result.append ("<ul class=%"vertical%" >%N")
|
||||||
|
end
|
||||||
|
across
|
||||||
|
a_menu as c
|
||||||
|
loop
|
||||||
|
append_cms_link_to (c.item, Result)
|
||||||
|
end
|
||||||
|
Result.append ("</ul>%N")
|
||||||
|
Result.append ("</div>")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
block_html (a_block: CMS_BLOCK): STRING_8
|
block_html (a_block: CMS_BLOCK): STRING_8
|
||||||
|
local
|
||||||
|
s: STRING
|
||||||
do
|
do
|
||||||
to_implement ("Add implementation")
|
if attached {CMS_CONTENT_BLOCK} a_block as l_content_block and then l_content_block.is_raw then
|
||||||
Result := "to be implemented"
|
create s.make_empty
|
||||||
|
if attached l_content_block.title as l_title then
|
||||||
|
s.append ("<div class=%"title%">" + html_encoded (l_title) + "</div>")
|
||||||
|
end
|
||||||
|
s.append (l_content_block.to_html (Current))
|
||||||
|
else
|
||||||
|
create s.make_from_string ("<div class=%"block%" id=%"" + a_block.name + "%">")
|
||||||
|
if attached a_block.title as l_title then
|
||||||
|
s.append ("<div class=%"title%">" + html_encoded (l_title) + "</div>")
|
||||||
|
end
|
||||||
|
s.append ("<div class=%"inside%">")
|
||||||
|
s.append (a_block.to_html (Current))
|
||||||
|
s.append ("</div>")
|
||||||
|
s.append ("</div>")
|
||||||
|
end
|
||||||
|
Result := s
|
||||||
end
|
end
|
||||||
|
|
||||||
prepare (page: CMS_HTML_PAGE)
|
prepare (page: CMS_HTML_PAGE)
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<head>
|
<head>
|
||||||
<title>{$title/}</title>
|
<title>{$page_title/}</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<!-- Page Top -->
|
<!-- Page Top -->
|
||||||
|
|||||||
@@ -98,7 +98,6 @@ feature -- Element change
|
|||||||
children := lst
|
children := lst
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
set_expanded (b: like is_expanded)
|
set_expanded (b: like is_expanded)
|
||||||
do
|
do
|
||||||
if b then
|
if b then
|
||||||
@@ -121,7 +120,6 @@ feature -- Element change
|
|||||||
internal_is_expandable := b
|
internal_is_expandable := b
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
set_permission_arguments (args: like permission_arguments)
|
set_permission_arguments (args: like permission_arguments)
|
||||||
do
|
do
|
||||||
permission_arguments := args
|
permission_arguments := args
|
||||||
|
|||||||
Reference in New Issue
Block a user