From ba58fcdf75d4804ce62830203529c6e8cf3764f2 Mon Sep 17 00:00:00 2001 From: Jocelyn Fiat Date: Thu, 20 Nov 2014 14:11:28 +0100 Subject: [PATCH] Updated cms library with comments, and removed a few JSON obsolete calls. --- .../src/configuration/json_configuration.e | 2 +- .../configuration/cms_json_configuration.e | 36 +++++++++++-------- library/src/theme/cms_template.e | 8 ++++- 3 files changed, 29 insertions(+), 17 deletions(-) diff --git a/library/layout/src/configuration/json_configuration.e b/library/layout/src/configuration/json_configuration.e index e8f0453..05c98fb 100644 --- a/library/layout/src/configuration/json_configuration.e +++ b/library/layout/src/configuration/json_configuration.e @@ -94,7 +94,7 @@ feature {NONE} -- JSON new_json_parser (a_string: STRING): JSON_PARSER do - create Result.make_parser (a_string) + create Result.make_with_string (a_string) end note diff --git a/library/src/configuration/cms_json_configuration.e b/library/src/configuration/cms_json_configuration.e index 6462a30..5ac35b6 100644 --- a/library/src/configuration/cms_json_configuration.e +++ b/library/src/configuration/cms_json_configuration.e @@ -6,7 +6,6 @@ note class CMS_JSON_CONFIGURATION - inherit JSON_CONFIGURATION @@ -19,29 +18,36 @@ feature -- Access l_parser: JSON_PARSER do if attached json_file_from (a_path) as json_file then - l_parser := new_json_parser (json_file) - if attached {JSON_OBJECT} l_parser.parse as jv and then l_parser.is_parsed and then - attached {JSON_OBJECT} jv.item ("server") as l_server and then - attached {JSON_STRING} l_server.item ("mode") as l_mode then - Result := l_mode.item.is_case_insensitive_equal_general ("html") - end + l_parser := new_json_parser (json_file) + l_parser.parse_content + if + l_parser.is_valid and then + attached l_parser.parsed_json_object as jo and then l_parser.is_parsed and then + attached {JSON_OBJECT} jo.item ("server") as l_server and then + attached {JSON_STRING} l_server.item ("mode") as l_mode + then + Result := l_mode.item.is_case_insensitive_equal_general ("html") + end end end - - is_web_mode (a_path: PATH): BOOLEAN -- Is the server running on web mode? local l_parser: JSON_PARSER do if attached json_file_from (a_path) as json_file then - l_parser := new_json_parser (json_file) - if attached {JSON_OBJECT} l_parser.parse as jv and then l_parser.is_parsed and then - attached {JSON_OBJECT} jv.item ("server") as l_server and then - attached {JSON_STRING} l_server.item ("mode") as l_mode then - Result := l_mode.item.is_case_insensitive_equal_general ("web") - end + l_parser := new_json_parser (json_file) + l_parser.parse_content + if + l_parser.is_valid and then + attached l_parser.parsed_json_object as jo and then l_parser.is_parsed and then + attached {JSON_OBJECT} jo.item ("server") as l_server and then + attached {JSON_STRING} l_server.item ("mode") as l_mode + then + Result := l_mode.item.is_case_insensitive_equal_general ("web") + end end end + end diff --git a/library/src/theme/cms_template.e b/library/src/theme/cms_template.e index 58eb0f0..f088368 100644 --- a/library/src/theme/cms_template.e +++ b/library/src/theme/cms_template.e @@ -1,5 +1,7 @@ note - description: "Summary description for {WSF_CMS_PAGE_TEMPLATE}." + description: "[ + Abstract interface for a CMS Template, as part of the theme design. + ]" date: "$Date$" revision: "$Revision$" @@ -9,18 +11,22 @@ deferred class feature -- Access theme: CMS_THEME + -- Associated theme. deferred end variables: STRING_TABLE [detachable ANY] + -- Variables used for Current template rendering. deferred end prepare (page: CMS_HTML_PAGE) + -- Prepare `page' with current template. deferred end to_html (page: CMS_HTML_PAGE): STRING + -- HTML rendering for page `page'. deferred end