note description: "Abstract class describing a generic theme" date: "$Date$" revision: "$Revision$" deferred class CMS_THEME inherit CMS_ENCODERS CMS_URL_UTILITIES REFACTORING_HELPER feature {NONE} -- Access api: CMS_API site_url: IMMUTABLE_STRING_8 -- Absolute URL for Current CMS site. base_url: detachable IMMUTABLE_STRING_8 -- Optional base url of current CMS site. 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 -- Status report has_region (a_region_name: READABLE_STRING_GENERAL): BOOLEAN -- Current theme has region `a_region_name' declared? do Result := across regions as ic some a_region_name.is_case_insensitive_equal (ic.item) end end feature -- Element change set_site_url (a_url: READABLE_STRING_8) -- Set `site_url' to `a_url'. require a_url.ends_with_general ("/") local i,j: INTEGER do base_url := Void if a_url [a_url.count] = '/' then create site_url.make_from_string (a_url) else create site_url.make_from_string (a_url + "/") end i := a_url.substring_index ("://", 1) if i > 0 then j := a_url.index_of ('/', i + 3) if j > 0 then create base_url.make_from_string (a_url.substring (j, a_url.count)) end end end feature -- Conversion menu_html (a_menu: CMS_MENU; is_horizontal: BOOLEAN; a_options: detachable CMS_HTML_OPTIONS): STRING_8 local cl: STRING do debug ("refactor_fixme") fixme ("Refactor HTML code to use the new Bootstrap theme template") end create cl.make_from_string ("menu") if a_options /= Void and then attached a_options.css_classes as lst then across lst as ic loop cl.append_character (' ') cl.append (ic.item) end end create Result.make_from_string ("
") if is_horizontal then Result.append ("
") end block_html (a_block: CMS_BLOCK): STRING_8 local s: STRING do debug ("refactor_fixme") fixme ("Refactor HTML code to use the new Bootstrap theme template") end if a_block.is_raw then create s.make_empty if attached a_block.title as l_title then s.append ("
" + html_encoded (l_title) + "
") end s.append (a_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 page_html (page: CMS_HTML_PAGE): STRING_8 -- Render `page' as html. deferred end feature {NONE} -- Implementation append_cms_link_to (lnk: CMS_LINK; s: STRING_8) local cl: STRING do if not lnk.is_forbidden then create cl.make_empty if lnk.is_active then cl.append ("active ") end if lnk.is_expandable then cl.append ("expandable ") end if lnk.is_expanded then cl.append ("expanded ") end if cl.is_empty then s.append ("
  • ") else s.append ("
  • ") end s.append ("") s.append (html_encoded (lnk.title)) s.append ("") if (lnk.is_expanded or lnk.is_collapsed) and then attached lnk.children as l_children then s.append ("") end s.append ("
  • ") end end note copyright: "2011-2017, Jocelyn Fiat, Javier Velilla, Eiffel Software and others" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" source: "[ Eiffel Software 5949 Hollister Ave., Goleta, CA 93117 USA Telephone 805-685-1006, Fax 805-685-6869 Website http://www.eiffel.com Customer support http://support.eiffel.com ]" end