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 s: READABLE_STRING_8 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 if a_url [a_url.count] = '/' then s := a_url.substring (j, a_url.count - 1) else s := a_url.substring (j, a_url.count) end if not s.is_empty then create base_url.make_from_string (s) end end end ensure valid_site_url: site_url.ends_with ("/") valid_base_url: attached base_url as e_base_url implies not e_base_url.ends_with ("/") 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 ("