diff --git a/cms/src/service/response/cms_response.e b/cms/src/service/response/cms_response.e index 97a5a65..56500a0 100644 --- a/cms/src/service/response/cms_response.e +++ b/cms/src/service/response/cms_response.e @@ -143,7 +143,7 @@ feature -- Blocks initialization -- FIXME: let the user choose ... create l_table.make_caseless (10) - l_table["page_top"] := "top" + l_table["top"] := "top" l_table["header"] := "header" l_table["highlighted"] := "highlighted" l_table["help"] := "help" @@ -152,7 +152,7 @@ feature -- Blocks initialization l_table["management"] := "first_sidebar" l_table["navigation"] := "first_sidebar" l_table["user"] := "first_sidebar" - l_table["page_bottom"] := "page_bottom" + l_table["bottom"] := "page_bottom" block_region_settings := l_table end @@ -275,13 +275,13 @@ feature -- Blocks local s: STRING do - fixme ("Avoid Hardcoded HTML") + fixme ("Avoid Hardcoded HTML!!!") -- create s.make_from_string ("
" + html_encoded (site_name) + "
") create s.make_empty s.append ("
") s.append (theme.menu_html (main_menu, True)) s.append ("
") - create Result.make ("top_header", Void, s, formats.full_html) + create Result.make ("header", Void, s, formats.full_html) Result.set_is_raw (True) end diff --git a/cms/src/theme/cms_html_page.e b/cms/src/theme/cms_html_page.e index 5c6a5c0..1565d07 100644 --- a/cms/src/theme/cms_html_page.e +++ b/cms/src/theme/cms_html_page.e @@ -1,7 +1,8 @@ note description: "Summary description for {CMS_HTML_PAGE}." - date: "$Date$" - revision: "$Revision$" + author: "" + date: "$Date: 2014-11-04 09:57:24 -0300 (ma. 04 de nov. de 2014) $" + revision: "$Revision: 96034 $" class CMS_HTML_PAGE @@ -23,6 +24,7 @@ feature {NONE} -- Initialization do create regions.make (5) language := "en" + status_code := {HTTP_STATUS_CODE}.ok create header.make create {ARRAYED_LIST [STRING]} head_lines.make (5) @@ -65,7 +67,7 @@ feature -- Header feature -- Region - regions: HASH_TABLE [STRING_8, STRING_8] + regions: STRING_TABLE [STRING_8] -- header -- content -- footer @@ -83,21 +85,6 @@ feature -- Region 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 register_variable (a_value: detachable ANY; k: READABLE_STRING_GENERAL) @@ -118,41 +105,11 @@ feature -- Element change 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) do regions.force (s, k) 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 set_status_code (c: like status_code) @@ -170,6 +127,50 @@ feature -- Element change title := s end + add_meta_name_content (a_name: STRING; a_content: STRING) + local + s: STRING_8 + do + s := "" + head_lines.extend (s) + end + + add_meta_http_equiv (a_http_equiv: STRING; a_content: STRING) + local + s: STRING_8 + do + s := "" + head_lines.extend (s) + end + + add_style (a_href: STRING; a_media: detachable STRING) + local + s: STRING_8 + do + s := "") + head_lines.extend (s) + end + + add_javascript_url (a_src: STRING) + local + s: STRING_8 + do + s := "" + head_lines.extend (s) + end + + add_javascript_content (a_script: STRING) + local + s: STRING_8 + do + s := "" + head_lines.extend (s) + end + note copyright: "2011-2014, Jocelyn Fiat, Eiffel Software and others" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" diff --git a/cms/src/theme/cms_theme.e b/cms/src/theme/cms_theme.e index c970bba..441f925 100644 --- a/cms/src/theme/cms_theme.e +++ b/cms/src/theme/cms_theme.e @@ -1,12 +1,16 @@ note description: "Summary description for {WSF_CMS_THEME}." - author: "" date: "$Date$" revision: "$Revision$" deferred class CMS_THEME +inherit + + REFACTORING_HELPER + + feature {NONE} -- Access setup: CMS_SETUP @@ -14,16 +18,20 @@ feature {NONE} -- Access feature -- Access name: STRING + -- theme name. deferred end regions: ARRAY [STRING] + -- theme's regions. deferred end page_template: CMS_TEMPLATE + -- theme template page. deferred end + feature -- Conversion menu_html (a_menu: CMS_MENU; is_horizontal: BOOLEAN): STRING_8 @@ -33,6 +41,7 @@ feature -- Conversion end block_html (a_block: CMS_BLOCK): STRING_8 + -- Render a block as HTML. deferred end @@ -47,6 +56,7 @@ feature {NONE} -- Implementation local cl: STRING do + fixme ("Remove HTML from Eiffel") create cl.make_empty if lnk.is_active then cl.append ("active ") diff --git a/cms/src/theme/cms_theme_information.e b/cms/src/theme/cms_theme_information.e index ee0800a..719b3c1 100644 --- a/cms/src/theme/cms_theme_information.e +++ b/cms/src/theme/cms_theme_information.e @@ -18,7 +18,7 @@ feature {NONE} -- Initialization create items.make_caseless (1) create regions.make (5) across - (<<"header", "content", "footer", "first_sidebar", "second_sidebar">>) as ic + (<<"top","header", "highlighted","help", "content", "footer", "first_sidebar", "second_sidebar", "bottom">>) as ic loop regions.force (ic.item, ic.item) end diff --git a/cms/src/theme/smarty_theme/smarty_cms_page_template.e b/cms/src/theme/smarty_theme/smarty_cms_page_template.e index b02fe15..188a743 100644 --- a/cms/src/theme/smarty_theme/smarty_cms_page_template.e +++ b/cms/src/theme/smarty_theme/smarty_cms_page_template.e @@ -55,7 +55,7 @@ feature -- Access across theme.regions as r loop - variables.force (page.region (r.item), r.item) + variables.force (page.region (r.item), "region_" + r.item) end end diff --git a/cms/src/theme/smarty_theme/smarty_cms_theme.e b/cms/src/theme/smarty_theme/smarty_cms_theme.e index 1debe62..88ee5aa 100644 --- a/cms/src/theme/smarty_theme/smarty_cms_theme.e +++ b/cms/src/theme/smarty_theme/smarty_cms_theme.e @@ -10,8 +10,6 @@ class inherit CMS_THEME - REFACTORING_HELPER - create make @@ -82,15 +80,43 @@ feature -- Conversion -- Render Menu as HTML. -- A theme will define a menu.tpl do - to_implement ("Add implementation") - Result := "to be implemented" + create Result.make_from_string ("
") + if is_horizontal then + Result.append ("
") end block_html (a_block: CMS_BLOCK): STRING_8 + local + s: STRING do - to_implement ("Add implementation") - Result := "to be implemented" + if attached {CMS_CONTENT_BLOCK} a_block as l_content_block and then l_content_block.is_raw then + create s.make_empty + if attached l_content_block.title as l_title then + s.append ("
" + html_encoded (l_title) + "
") + end + s.append (l_content_block.to_html (Current)) + else + create s.make_from_string ("
") + if attached a_block.title as l_title then + s.append ("
" + html_encoded (l_title) + "
") + end + s.append ("
") + s.append (a_block.to_html (Current)) + s.append ("
") + s.append ("
") + end + Result := s end prepare (page: CMS_HTML_PAGE) diff --git a/examples/roc_api/site/www/themes/bootstrap/page.tpl b/examples/roc_api/site/www/themes/bootstrap/page.tpl index 36952f5..54e6aaa 100644 --- a/examples/roc_api/site/www/themes/bootstrap/page.tpl +++ b/examples/roc_api/site/www/themes/bootstrap/page.tpl @@ -13,7 +13,7 @@ -{$title/} +{$page_title/} diff --git a/model/src/cms_local_link.e b/model/src/cms_local_link.e index f6bd165..876b47e 100644 --- a/model/src/cms_local_link.e +++ b/model/src/cms_local_link.e @@ -98,7 +98,6 @@ feature -- Element change children := lst end - set_expanded (b: like is_expanded) do if b then @@ -121,7 +120,6 @@ feature -- Element change internal_is_expandable := b end - set_permission_arguments (args: like permission_arguments) do permission_arguments := args