From 8d59d25aceabe58d7957721aa1c4047dc2e98cb3 Mon Sep 17 00:00:00 2001 From: Jocelyn Fiat Date: Mon, 16 Feb 2015 13:01:06 +0100 Subject: [PATCH] Added weight into to the CMS_LINK and provide a `sort' feature for CMS_MENU and related. Protected cms service from registering many time the same module type. Moved library/persistence/implementation/* under library/persistence/. Moved site/www/themes to site/themes For SQLite storage driver, auto create sqlite db file using associated sql script (to be completed). Added code in demo module to reuse storage for module purpose. Always call sql_post_execution in sql_query and sql_change, and not anymore by the callers. Removed is_web and is_html from {CMS_SETUP}, it was not used. Reused SHARED_*_ENCODER in CMS_ENCODERS Added CMS_API.logger rather than using directly the SHARED_LOGGER.log ... Centralize the implementation of current_user in CMS_REQUEST_UTIL Removed the inheritance on WSF_FILTER for node handlers, since it is useless and unused. Added CMS_NODE_API and CMS_USER_API Prefix html id for block generated html items with "block-", to avoid css name conflict on "main", "content" or similar. Code cleaning --- cms-safe.ecf | 2 +- cms.ecf | 5 +- examples/demo/demo-safe.ecf | 5 +- .../launcher/default/application_launcher_i.e | 6 +- examples/demo/modules/demo/cms_demo_module.e | 31 ++- examples/demo/site/config/cms.ini | 2 +- examples/demo/site/scripts/sqlite.sql | 34 +++ .../themes/bootstrap/assets/css/style.css | 53 ++++ .../themes/bootstrap/assets/scss/style.scss | 57 ++++ .../themes/bootstrap/block/header_block.tpl | 0 examples/demo/site/themes/bootstrap/debug.tpl | 14 + examples/demo/site/themes/bootstrap/page.tpl | 77 ++++++ .../{www => }/themes/bootstrap/theme.info | 0 .../themes/bootstrap/tpl/help_section.tpl | 0 .../bootstrap/tpl/highlighted_section.tpl | 0 .../themes/bootstrap/tpl/left_sidebar.tpl | 0 .../themes/bootstrap/tpl/main_content.tpl | 0 .../themes/bootstrap/tpl/page_bottom.tpl | 0 .../themes/bootstrap/tpl/page_footer.tpl | 0 .../themes/bootstrap/tpl/page_header.tpl | 0 .../themes/bootstrap/tpl/page_header2.tpl | 0 .../themes/bootstrap/tpl/page_top.tpl | 0 .../themes/bootstrap/tpl/primary_nav.tpl | 0 .../themes/bootstrap/tpl/right_sidebar.tpl | 0 .../themes/bootstrap/tpl/secondary_nav.tpl | 0 examples/demo/site/www/themes/api/layout.tpl | 36 --- examples/demo/site/www/themes/api/layout2.tpl | 40 --- .../themes/api/master2/basic_auth/logoff.tpl | 5 - .../site/www/themes/api/master2/content.tpl | 11 - .../site/www/themes/api/master2/error.tpl | 18 -- .../site/www/themes/api/master2/footer.tpl | 7 - .../demo/site/www/themes/api/master2/head.tpl | 10 - .../site/www/themes/api/master2/header.tpl | 2 - .../themes/api/master2/main_navigation.tpl | 5 - .../api/master2/optional_enhancement_js.tpl | 5 - .../api/master2/optional_styling_css.tpl | 9 - .../themes/api/master2/site_navigation.tpl | 27 -- .../www/themes/api/modules/navigation.tpl | 8 - .../demo/site/www/themes/api/modules/node.tpl | 174 ------------ .../www/themes/api/modules/node_content.tpl | 70 ----- .../www/themes/api/modules/node_summary.tpl | 71 ----- .../www/themes/api/modules/node_title.tpl | 70 ----- .../site/www/themes/api/modules/nodes.tpl | 52 ---- .../site/www/themes/api/modules/register.tpl | 100 ------- examples/demo/site/www/themes/api/theme.info | 9 - examples/demo/site/www/themes/bootstrap.7z | Bin 2576 -> 0 bytes .../demo/site/www/themes/bootstrap/page.tpl | 84 ------ .../www/themes/bootstrap/roc_template -2.html | 108 -------- .../www/themes/bootstrap/roc_template.html | 135 ---------- .../site/www/themes/smarty/front-page.tpl | 12 - examples/demo/site/www/themes/smarty/page.tpl | 11 - .../demo/site/www/themes/smarty/res/ewfcms.js | 91 ------- .../site/www/themes/smarty/res/favicon.ico | Bin 786 -> 0 bytes .../demo/site/www/themes/smarty/res/logo.png | Bin 3193 -> 0 bytes .../www/themes/smarty/res/menu-collapsed.png | Bin 108 -> 0 bytes .../www/themes/smarty/res/menu-expanded.png | Bin 106 -> 0 bytes .../demo/site/www/themes/smarty/res/style.css | 251 ------------------ .../demo/site/www/themes/smarty/theme.info | 10 - .../www/themes/smarty/tpl/page-footer.tpl | 6 - .../www/themes/smarty/tpl/page-header.tpl | 14 - examples/demo/src/ewf_roc_server.e | 10 +- .../configuration/database_configuration.e | 6 +- library/model/cms_model-safe.ecf | 2 +- library/model/cms_model.ecf | 2 +- library/model/src/link/cms_link.e | 45 +++- library/model/src/link/cms_link_composite.e | 27 +- library/model/src/link/cms_local_link.e | 8 +- library/model/src/link/cms_menu.e | 17 +- .../mysql/src/cms_storage_mysql.e | 112 -------- .../sqlite/src/cms_storage_sqlite.e | 112 -------- .../sqlite/src/cms_storage_sqlite_builder.e | 43 --- .../{common => store}/cms_storage_store_sql.e | 14 +- .../database/database_config.e | 0 .../database/database_connection.e | 0 .../database/database_connection_null.e | 0 .../database/database_connection_odbc.e | 0 .../database/database_handler.e | 0 .../database/database_handler_impl.e | 0 .../database/database_iteration_cursor.e | 0 .../database/database_null.e | 0 .../database/database_query.e | 0 .../database/database_sql_server_encoder.e | 0 .../database/database_store_procedure.e | 0 .../database/error/database_error.e | 0 .../database/error/database_error_handler.e | 0 .../database/error/database_no_change_error.e | 0 .../database/parameter_name_helper.e | 0 .../mysql/persistence_mysql-safe.ecf | 8 +- .../mysql/persistence_mysql.ecf | 8 +- .../mysql/scripts/Readme.md | 0 .../mysql/scripts/Readme.txt | 0 .../mysql/scripts/create_database.sql | 0 .../mysql/scripts/schema.sql | 0 .../mysql/scripts/tables.sql | 0 .../mysql/scripts/triggers.sql | 0 .../mysql/src/cms_node_storage_mysql.e | 0 .../persistence/mysql/src/cms_storage_mysql.e | 31 +++ .../mysql/src/cms_storage_mysql_builder.e | 0 .../mysql/src/cms_user_storage_mysql.e | 0 .../src/database/database_connection_mysql.e | 0 .../mysql/tests/application.e | 0 .../tests/handler/database_handler_test.e | 0 .../mysql/tests/nodes/node_test_set.e | 0 .../mysql/tests/roles/role_test_set.e- | 100 +++++++ .../mysql/tests/storage/storage_test_set.e | 0 .../mysql/tests/tests.ecf | 4 +- .../tests/transactions/transaction_test_set.e | 0 .../mysql/tests/users/user_test_set.e | 0 .../mysql/tests/util/abstract_db_test.e | 0 .../mysql/tests/util/clean_db.e | 0 .../sqlite/persistence_sqlite-safe.ecf | 8 +- .../sqlite/persistence_sqlite.ecf | 8 +- .../sqlite/scripts/Readme.txt | 0 .../sqlite/scripts/schema.sql | 0 .../sqlite/src/cms_node_storage_sqlite.e | 6 +- .../sqlite/src/cms_storage_sqlite.e | 31 +++ .../sqlite/src/cms_storage_sqlite_builder.e | 91 +++++++ .../sqlite/src/cms_user_storage_sqlite.e | 0 .../sqlite/tests/Readme.md | 0 .../sqlite/tests/application.e | 0 .../sqlite/tests/cms_lite.db | Bin 18432 -> 18432 bytes .../sqlite/tests/nodes/node_test_set.e | 0 .../sqlite/tests/storage/storage_test_set.e | 0 .../sqlite/tests/tests-safe.ecf | 4 +- .../sqlite/tests/users/user_test_set.e | 0 .../sqlite/tests/util/abstract_db_test.e | 0 .../sqlite/tests/util/clean_db.e | 0 src/configuration/cms_default_setup.e | 23 +- src/configuration/cms_setup.e | 34 +-- src/kernel/content/cms_block.e | 2 +- src/kernel/content/cms_encoders.e | 43 +-- src/modules/basic_auth/basic_auth_module.e | 56 +++- .../basic_auth/filter/basic_auth_filter.e | 25 +- .../handler/basic_auth_login_handler.e | 6 +- .../handler/basic_auth_logoff_handler.e | 6 +- src/modules/cms_module_collection.e | 23 +- src/modules/node/cms_node_api.e | 98 +++++++ src/modules/node/handler/cms_node_handler.e | 16 ++ .../node/handler/node_content_handler.e | 22 +- src/modules/node/handler/node_handler.e | 30 +-- .../node/handler/node_summary_handler.e | 21 +- src/modules/node/handler/node_title_handler.e | 21 +- src/modules/node/handler/nodes_handler.e | 18 +- src/modules/node/node_module.e | 53 ++-- src/persistence/cms_storage.e | 16 +- src/persistence/cms_storage_null.e | 18 +- src/persistence/cms_storage_sql.e | 18 +- src/persistence/node/cms_node_storage_sql.e | 19 +- src/persistence/user/cms_user_storage_sql.e | 15 +- src/service/cms_api.e | 238 ++++++----------- src/service/cms_module_api.e | 26 ++ src/service/cms_service.e | 10 +- src/service/filter/cms_error_filter.e | 14 +- src/service/handler/cms_handler.e | 15 +- src/service/handler/cms_module_handler.e | 27 ++ src/service/handler/cms_root_handler.e | 15 +- src/service/logger/cms_env_logger.e | 60 +++++ src/service/logger/cms_logger.e | 55 ++++ src/service/logger/cms_null_logger.e | 39 +++ src/service/{ => misc}/cms_request_util.e | 21 +- src/service/{ => misc}/cms_url_utilities.e | 4 +- src/service/response/cms_response.e | 21 +- src/service/user/cms_user_api.e | 62 +++++ src/theme/cms_theme.e | 6 +- src/theme/smarty_theme/smarty_cms_theme.e | 6 +- 165 files changed, 1430 insertions(+), 2206 deletions(-) create mode 100644 examples/demo/site/scripts/sqlite.sql create mode 100644 examples/demo/site/themes/bootstrap/assets/css/style.css create mode 100644 examples/demo/site/themes/bootstrap/assets/scss/style.scss rename examples/demo/site/{www => }/themes/bootstrap/block/header_block.tpl (100%) create mode 100644 examples/demo/site/themes/bootstrap/debug.tpl create mode 100644 examples/demo/site/themes/bootstrap/page.tpl rename examples/demo/site/{www => }/themes/bootstrap/theme.info (100%) rename examples/demo/site/{www => }/themes/bootstrap/tpl/help_section.tpl (100%) rename examples/demo/site/{www => }/themes/bootstrap/tpl/highlighted_section.tpl (100%) rename examples/demo/site/{www => }/themes/bootstrap/tpl/left_sidebar.tpl (100%) rename examples/demo/site/{www => }/themes/bootstrap/tpl/main_content.tpl (100%) rename examples/demo/site/{www => }/themes/bootstrap/tpl/page_bottom.tpl (100%) rename examples/demo/site/{www => }/themes/bootstrap/tpl/page_footer.tpl (100%) rename examples/demo/site/{www => }/themes/bootstrap/tpl/page_header.tpl (100%) rename examples/demo/site/{www => }/themes/bootstrap/tpl/page_header2.tpl (100%) rename examples/demo/site/{www => }/themes/bootstrap/tpl/page_top.tpl (100%) rename examples/demo/site/{www => }/themes/bootstrap/tpl/primary_nav.tpl (100%) rename examples/demo/site/{www => }/themes/bootstrap/tpl/right_sidebar.tpl (100%) rename examples/demo/site/{www => }/themes/bootstrap/tpl/secondary_nav.tpl (100%) delete mode 100644 examples/demo/site/www/themes/api/layout.tpl delete mode 100644 examples/demo/site/www/themes/api/layout2.tpl delete mode 100644 examples/demo/site/www/themes/api/master2/basic_auth/logoff.tpl delete mode 100644 examples/demo/site/www/themes/api/master2/content.tpl delete mode 100644 examples/demo/site/www/themes/api/master2/error.tpl delete mode 100644 examples/demo/site/www/themes/api/master2/footer.tpl delete mode 100644 examples/demo/site/www/themes/api/master2/head.tpl delete mode 100644 examples/demo/site/www/themes/api/master2/header.tpl delete mode 100644 examples/demo/site/www/themes/api/master2/main_navigation.tpl delete mode 100644 examples/demo/site/www/themes/api/master2/optional_enhancement_js.tpl delete mode 100644 examples/demo/site/www/themes/api/master2/optional_styling_css.tpl delete mode 100644 examples/demo/site/www/themes/api/master2/site_navigation.tpl delete mode 100644 examples/demo/site/www/themes/api/modules/navigation.tpl delete mode 100644 examples/demo/site/www/themes/api/modules/node.tpl delete mode 100644 examples/demo/site/www/themes/api/modules/node_content.tpl delete mode 100644 examples/demo/site/www/themes/api/modules/node_summary.tpl delete mode 100644 examples/demo/site/www/themes/api/modules/node_title.tpl delete mode 100644 examples/demo/site/www/themes/api/modules/nodes.tpl delete mode 100644 examples/demo/site/www/themes/api/modules/register.tpl delete mode 100644 examples/demo/site/www/themes/api/theme.info delete mode 100644 examples/demo/site/www/themes/bootstrap.7z delete mode 100644 examples/demo/site/www/themes/bootstrap/page.tpl delete mode 100644 examples/demo/site/www/themes/bootstrap/roc_template -2.html delete mode 100644 examples/demo/site/www/themes/bootstrap/roc_template.html delete mode 100644 examples/demo/site/www/themes/smarty/front-page.tpl delete mode 100644 examples/demo/site/www/themes/smarty/page.tpl delete mode 100644 examples/demo/site/www/themes/smarty/res/ewfcms.js delete mode 100644 examples/demo/site/www/themes/smarty/res/favicon.ico delete mode 100644 examples/demo/site/www/themes/smarty/res/logo.png delete mode 100644 examples/demo/site/www/themes/smarty/res/menu-collapsed.png delete mode 100644 examples/demo/site/www/themes/smarty/res/menu-expanded.png delete mode 100644 examples/demo/site/www/themes/smarty/res/style.css delete mode 100644 examples/demo/site/www/themes/smarty/theme.info delete mode 100644 examples/demo/site/www/themes/smarty/tpl/page-footer.tpl delete mode 100644 examples/demo/site/www/themes/smarty/tpl/page-header.tpl delete mode 100644 library/persistence/implementation/mysql/src/cms_storage_mysql.e delete mode 100644 library/persistence/implementation/sqlite/src/cms_storage_sqlite.e delete mode 100644 library/persistence/implementation/sqlite/src/cms_storage_sqlite_builder.e rename library/persistence/implementation/{common => store}/cms_storage_store_sql.e (89%) rename library/persistence/implementation/{common => store}/database/database_config.e (100%) rename library/persistence/implementation/{common => store}/database/database_connection.e (100%) rename library/persistence/implementation/{common => store}/database/database_connection_null.e (100%) rename library/persistence/implementation/{common => store}/database/database_connection_odbc.e (100%) rename library/persistence/implementation/{common => store}/database/database_handler.e (100%) rename library/persistence/implementation/{common => store}/database/database_handler_impl.e (100%) rename library/persistence/implementation/{common => store}/database/database_iteration_cursor.e (100%) rename library/persistence/implementation/{common => store}/database/database_null.e (100%) rename library/persistence/implementation/{common => store}/database/database_query.e (100%) rename library/persistence/implementation/{common => store}/database/database_sql_server_encoder.e (100%) rename library/persistence/implementation/{common => store}/database/database_store_procedure.e (100%) rename library/persistence/implementation/{common => store}/database/error/database_error.e (100%) rename library/persistence/implementation/{common => store}/database/error/database_error_handler.e (100%) rename library/persistence/implementation/{common => store}/database/error/database_no_change_error.e (100%) rename library/persistence/implementation/{common => store}/database/parameter_name_helper.e (100%) rename library/persistence/{implementation => }/mysql/persistence_mysql-safe.ecf (87%) rename library/persistence/{implementation => }/mysql/persistence_mysql.ecf (87%) rename library/persistence/{implementation => }/mysql/scripts/Readme.md (100%) rename library/persistence/{implementation => }/mysql/scripts/Readme.txt (100%) rename library/persistence/{implementation => }/mysql/scripts/create_database.sql (100%) rename library/persistence/{implementation => }/mysql/scripts/schema.sql (100%) rename library/persistence/{implementation => }/mysql/scripts/tables.sql (100%) rename library/persistence/{implementation => }/mysql/scripts/triggers.sql (100%) rename library/persistence/{implementation => }/mysql/src/cms_node_storage_mysql.e (100%) create mode 100644 library/persistence/mysql/src/cms_storage_mysql.e rename library/persistence/{implementation => }/mysql/src/cms_storage_mysql_builder.e (100%) rename library/persistence/{implementation => }/mysql/src/cms_user_storage_mysql.e (100%) rename library/persistence/{implementation => }/mysql/src/database/database_connection_mysql.e (100%) rename library/persistence/{implementation => }/mysql/tests/application.e (100%) rename library/persistence/{implementation => }/mysql/tests/handler/database_handler_test.e (100%) rename library/persistence/{implementation => }/mysql/tests/nodes/node_test_set.e (100%) create mode 100644 library/persistence/mysql/tests/roles/role_test_set.e- rename library/persistence/{implementation => }/mysql/tests/storage/storage_test_set.e (100%) rename library/persistence/{implementation => }/mysql/tests/tests.ecf (89%) rename library/persistence/{implementation => }/mysql/tests/transactions/transaction_test_set.e (100%) rename library/persistence/{implementation => }/mysql/tests/users/user_test_set.e (100%) rename library/persistence/{implementation => }/mysql/tests/util/abstract_db_test.e (100%) rename library/persistence/{implementation => }/mysql/tests/util/clean_db.e (100%) rename library/persistence/{implementation => }/sqlite/persistence_sqlite-safe.ecf (87%) rename library/persistence/{implementation => }/sqlite/persistence_sqlite.ecf (87%) rename library/persistence/{implementation => }/sqlite/scripts/Readme.txt (100%) rename library/persistence/{implementation => }/sqlite/scripts/schema.sql (100%) rename library/persistence/{implementation => }/sqlite/src/cms_node_storage_sqlite.e (92%) create mode 100644 library/persistence/sqlite/src/cms_storage_sqlite.e create mode 100644 library/persistence/sqlite/src/cms_storage_sqlite_builder.e rename library/persistence/{implementation => }/sqlite/src/cms_user_storage_sqlite.e (100%) rename library/persistence/{implementation => }/sqlite/tests/Readme.md (100%) rename library/persistence/{implementation => }/sqlite/tests/application.e (100%) rename library/persistence/{implementation => }/sqlite/tests/cms_lite.db (92%) rename library/persistence/{implementation => }/sqlite/tests/nodes/node_test_set.e (100%) rename library/persistence/{implementation => }/sqlite/tests/storage/storage_test_set.e (100%) rename library/persistence/{implementation => }/sqlite/tests/tests-safe.ecf (89%) rename library/persistence/{implementation => }/sqlite/tests/users/user_test_set.e (100%) rename library/persistence/{implementation => }/sqlite/tests/util/abstract_db_test.e (100%) rename library/persistence/{implementation => }/sqlite/tests/util/clean_db.e (100%) create mode 100644 src/modules/node/cms_node_api.e create mode 100644 src/modules/node/handler/cms_node_handler.e create mode 100644 src/service/cms_module_api.e create mode 100644 src/service/handler/cms_module_handler.e create mode 100644 src/service/logger/cms_env_logger.e create mode 100644 src/service/logger/cms_logger.e create mode 100644 src/service/logger/cms_null_logger.e rename src/service/{ => misc}/cms_request_util.e (69%) rename src/service/{ => misc}/cms_url_utilities.e (96%) create mode 100644 src/service/user/cms_user_api.e diff --git a/cms-safe.ecf b/cms-safe.ecf index e727727..3cabebe 100644 --- a/cms-safe.ecf +++ b/cms-safe.ecf @@ -14,7 +14,7 @@ - + diff --git a/cms.ecf b/cms.ecf index 9877329..727cca1 100644 --- a/cms.ecf +++ b/cms.ecf @@ -6,16 +6,15 @@ + - - - + diff --git a/examples/demo/demo-safe.ecf b/examples/demo/demo-safe.ecf index b0b7ae1..e778586 100644 --- a/examples/demo/demo-safe.ecf +++ b/examples/demo/demo-safe.ecf @@ -13,9 +13,10 @@ + - - + + diff --git a/examples/demo/launcher/default/application_launcher_i.e b/examples/demo/launcher/default/application_launcher_i.e index 2cd4a73..e665189 100644 --- a/examples/demo/launcher/default/application_launcher_i.e +++ b/examples/demo/launcher/default/application_launcher_i.e @@ -6,8 +6,8 @@ note you can customize APPLICATION_LAUNCHER ]" - date: "$Date: 2013-06-12 13:55:42 +0200 (mer., 12 juin 2013) $" - revision: "$Revision: 36 $" + date: "$Date: 2015-02-09 22:29:56 +0100 (lun., 09 févr. 2015) $" + revision: "$Revision: 96596 $" deferred class APPLICATION_LAUNCHER_I @@ -16,7 +16,7 @@ feature -- Execution launch (a_service: WSF_SERVICE; opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS) local - launcher: WSF_SERVICE_LAUNCHER + launcher: WSF_DEFAULT_SERVICE_LAUNCHER do create {WSF_DEFAULT_SERVICE_LAUNCHER} launcher.make_and_launch (a_service, opts) end diff --git a/examples/demo/modules/demo/cms_demo_module.e b/examples/demo/modules/demo/cms_demo_module.e index 756f877..f038073 100644 --- a/examples/demo/modules/demo/cms_demo_module.e +++ b/examples/demo/modules/demo/cms_demo_module.e @@ -1,8 +1,8 @@ note description: "Summary description for {CMS_DEMO_MODULE}." author: "" - date: "$Date$" - revision: "$Revision$" + date: "$Date: 2015-02-13 13:08:13 +0100 (ven., 13 févr. 2015) $" + revision: "$Revision: 96616 $" class CMS_DEMO_MODULE @@ -36,7 +36,6 @@ feature -- Access: router -- Node router. do create Result.make (2) - map_uri_template_agent (Result, "/demo/", agent handle_demo (?,?,a_api)) map_uri_template_agent (Result, "/demo/{id}", agent handle_demo_entry (?,?,a_api)) end @@ -85,11 +84,37 @@ feature -- Hooks feature -- Handler + initialize_module (a_api: CMS_API) + local + sql: STRING + do + if attached {CMS_STORAGE_SQL} a_api.storage as sql_db then + sql_db.sql_query ("select count(*) from tb_demo;", Void) + if sql_db.has_error then + -- Initialize db for demo module + sql := "[ +CREATE TABLE "tb_demo"( + "did" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL CHECK("did">=0), + "name" VARCHAR(100) NOT NULL, + "value" TEXT +); + ]" + sql_db.reset_error + sql_db.sql_change (sql, Void) + if sql_db.has_error then + a_api.logger.put_error ("Could not initialize database for demo module", generating_type) + end + end + end + end + handle_demo, handle_demo_entry (req: WSF_REQUEST; res: WSF_RESPONSE; a_api: CMS_API) local r: NOT_IMPLEMENTED_ERROR_CMS_RESPONSE do + initialize_module (a_api) + create r.make (req, res, a_api) r.set_main_content ("NODE module does not yet implement %"" + req.path_info + "%" ...") r.add_error_message ("NODE Module: not yet implemented") diff --git a/examples/demo/site/config/cms.ini b/examples/demo/site/config/cms.ini index 5879f35..f434169 100644 --- a/examples/demo/site/config/cms.ini +++ b/examples/demo/site/config/cms.ini @@ -1,6 +1,6 @@ [layout] root-dir=site/www -themes-dir=site/www/themes +themes-dir=site/themes [site] name=Eiffel CMS diff --git a/examples/demo/site/scripts/sqlite.sql b/examples/demo/site/scripts/sqlite.sql new file mode 100644 index 0000000..ab6db34 --- /dev/null +++ b/examples/demo/site/scripts/sqlite.sql @@ -0,0 +1,34 @@ +BEGIN; +CREATE TABLE "users"( + "uid" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL CHECK("uid">=0), + "name" VARCHAR(100) NOT NULL, + "password" VARCHAR(100) NOT NULL, + "salt" VARCHAR(100) NOT NULL, + "email" VARCHAR(250) NOT NULL, + "status" INTEGER, + "created" DATETIME NOT NULL, + "signed" DATETIME, + CONSTRAINT "name" + UNIQUE("name") +); + +CREATE TABLE "users_roles"( + "rid" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL CHECK("rid">=0), + "role" VARCHAR(100) NOT NULL, + CONSTRAINT "role" + UNIQUE("role") +); + +CREATE TABLE "nodes"( + "nid" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL CHECK("nid">=0), + "version" INTEGER, + "type" INTEGER, + "title" VARCHAR(255) NOT NULL, + "summary" TEXT NOT NULL, + "content" MEDIUMTEXT NOT NULL, + "author" INTEGER, + "publish" DATETIME, + "created" DATETIME NOT NULL, + "changed" DATETIME NOT NULL +); +COMMIT; diff --git a/examples/demo/site/themes/bootstrap/assets/css/style.css b/examples/demo/site/themes/bootstrap/assets/css/style.css new file mode 100644 index 0000000..05182b7 --- /dev/null +++ b/examples/demo/site/themes/bootstrap/assets/css/style.css @@ -0,0 +1,53 @@ +ul.horizontal li { + display: inline-block; +} + +#header #primary.menu ul li { + color: #555; + background-color: #fff; + padding: 10px; + margin: 0; +} +#header #primary.menu ul li a { + color: #555; + text-decoration: none; +} +#header #primary.menu ul li a:hover { + color: black; +} +#header #primary.menu ul.horizontal { + border-bottom: solid 1px #ddd; +} +#header #primary.menu ul.horizontal li { + border-top: solid 3px #fff; +} +#header #primary.menu ul.horizontal li:hover { + background-color: #ffe; + border-top: solid 3px #999; +} +#header #primary.menu ul.horizontal li.active { + font-weight: bold; + border-top: solid 3px #ddd; + background-color: #ddd; +} +#header #primary.menu ul.horizontal li.active:hover { + border-top: solid 3px blue; +} + +#content { + margin-left: 20px; +} + +.sidebar { + padding: 5px; + margin: 3px; + border: solid 1px #ccc; +} +.sidebar#sidebar_first { + width: 250px; + float: left; +} +.sidebar#sidebar_second { + width: 250px; + float: right; +} diff --git a/examples/demo/site/themes/bootstrap/assets/scss/style.scss b/examples/demo/site/themes/bootstrap/assets/scss/style.scss new file mode 100644 index 0000000..8debd65 --- /dev/null +++ b/examples/demo/site/themes/bootstrap/assets/scss/style.scss @@ -0,0 +1,57 @@ +ul.horizontal { + li { + display: inline-block; + } +} + +#header { + #primary.menu { + ul { + li { + color: #555; + a { + color: #555; + text-decoration: none; + &:hover { color: black; } + } + background-color: #fff; + padding: 10px; + margin: 0; + } + &.horizontal { + border-bottom: solid 1px #ddd; + li { + border-top: solid 3px #fff; + &:hover { + background-color: #ffe; + border-top: solid 3px #999; + } + &.active { + font-weight: bold; + border-top: solid 3px #ddd; + background-color: #ddd; + } + &.active:hover { + border-top: solid 3px blue; + } + } + } + } + } +} +#content { + margin-left: 20px; +} +.sidebar { + padding: 5px; + margin: 3px; + border: solid 1px #ccc; + &#sidebar_first { + width: 250px; + float: left; + } + &#sidebar_second { + width: 250px; + float: right; + } +} diff --git a/examples/demo/site/www/themes/bootstrap/block/header_block.tpl b/examples/demo/site/themes/bootstrap/block/header_block.tpl similarity index 100% rename from examples/demo/site/www/themes/bootstrap/block/header_block.tpl rename to examples/demo/site/themes/bootstrap/block/header_block.tpl diff --git a/examples/demo/site/themes/bootstrap/debug.tpl b/examples/demo/site/themes/bootstrap/debug.tpl new file mode 100644 index 0000000..6031876 --- /dev/null +++ b/examples/demo/site/themes/bootstrap/debug.tpl @@ -0,0 +1,14 @@ +{assign name="debug_enabled" value="True"/} +{if condition="$debug_enabled"} +
    +{assign name="kpage" value="page"/} +{assign name="kregions" value="regions"/} +{foreach key="k" item="i" from="$page.variables"} + {unless condition="$k ~ $kpage"} + {unless condition="$k ~ $kregions"} +
  • {$k/}={$i/}
  • + {/unless} + {/unless} +{/foreach} +
+{/if} diff --git a/examples/demo/site/themes/bootstrap/page.tpl b/examples/demo/site/themes/bootstrap/page.tpl new file mode 100644 index 0000000..577af62 --- /dev/null +++ b/examples/demo/site/themes/bootstrap/page.tpl @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + {$head_title/} + + + + {if isset="$region_top"} + {$region_top/} + {/if} + +
+ + + + + +
+ + {unless isempty="$page.region_sidebar_first"} + + {/unless} + + {unless isempty="$page.region_sidebar_second"} + + {/unless} + + +
+ + {unless isempty="$page.region_highlighted"} +
{$page.region_highlighted/}
+ {/unless} + + {unless isempty="$page.region_help"} +
{$page.region_help/}
+ {/unless} + + + {unless isempty="$page_title"}

{$page_title/}

{/unless} + {$page.region_content/} +
+ + +
+
+ + + {$page.region_footer/} + + + {$page.region_bottom/} + + + + + + + + + diff --git a/examples/demo/site/www/themes/bootstrap/theme.info b/examples/demo/site/themes/bootstrap/theme.info similarity index 100% rename from examples/demo/site/www/themes/bootstrap/theme.info rename to examples/demo/site/themes/bootstrap/theme.info diff --git a/examples/demo/site/www/themes/bootstrap/tpl/help_section.tpl b/examples/demo/site/themes/bootstrap/tpl/help_section.tpl similarity index 100% rename from examples/demo/site/www/themes/bootstrap/tpl/help_section.tpl rename to examples/demo/site/themes/bootstrap/tpl/help_section.tpl diff --git a/examples/demo/site/www/themes/bootstrap/tpl/highlighted_section.tpl b/examples/demo/site/themes/bootstrap/tpl/highlighted_section.tpl similarity index 100% rename from examples/demo/site/www/themes/bootstrap/tpl/highlighted_section.tpl rename to examples/demo/site/themes/bootstrap/tpl/highlighted_section.tpl diff --git a/examples/demo/site/www/themes/bootstrap/tpl/left_sidebar.tpl b/examples/demo/site/themes/bootstrap/tpl/left_sidebar.tpl similarity index 100% rename from examples/demo/site/www/themes/bootstrap/tpl/left_sidebar.tpl rename to examples/demo/site/themes/bootstrap/tpl/left_sidebar.tpl diff --git a/examples/demo/site/www/themes/bootstrap/tpl/main_content.tpl b/examples/demo/site/themes/bootstrap/tpl/main_content.tpl similarity index 100% rename from examples/demo/site/www/themes/bootstrap/tpl/main_content.tpl rename to examples/demo/site/themes/bootstrap/tpl/main_content.tpl diff --git a/examples/demo/site/www/themes/bootstrap/tpl/page_bottom.tpl b/examples/demo/site/themes/bootstrap/tpl/page_bottom.tpl similarity index 100% rename from examples/demo/site/www/themes/bootstrap/tpl/page_bottom.tpl rename to examples/demo/site/themes/bootstrap/tpl/page_bottom.tpl diff --git a/examples/demo/site/www/themes/bootstrap/tpl/page_footer.tpl b/examples/demo/site/themes/bootstrap/tpl/page_footer.tpl similarity index 100% rename from examples/demo/site/www/themes/bootstrap/tpl/page_footer.tpl rename to examples/demo/site/themes/bootstrap/tpl/page_footer.tpl diff --git a/examples/demo/site/www/themes/bootstrap/tpl/page_header.tpl b/examples/demo/site/themes/bootstrap/tpl/page_header.tpl similarity index 100% rename from examples/demo/site/www/themes/bootstrap/tpl/page_header.tpl rename to examples/demo/site/themes/bootstrap/tpl/page_header.tpl diff --git a/examples/demo/site/www/themes/bootstrap/tpl/page_header2.tpl b/examples/demo/site/themes/bootstrap/tpl/page_header2.tpl similarity index 100% rename from examples/demo/site/www/themes/bootstrap/tpl/page_header2.tpl rename to examples/demo/site/themes/bootstrap/tpl/page_header2.tpl diff --git a/examples/demo/site/www/themes/bootstrap/tpl/page_top.tpl b/examples/demo/site/themes/bootstrap/tpl/page_top.tpl similarity index 100% rename from examples/demo/site/www/themes/bootstrap/tpl/page_top.tpl rename to examples/demo/site/themes/bootstrap/tpl/page_top.tpl diff --git a/examples/demo/site/www/themes/bootstrap/tpl/primary_nav.tpl b/examples/demo/site/themes/bootstrap/tpl/primary_nav.tpl similarity index 100% rename from examples/demo/site/www/themes/bootstrap/tpl/primary_nav.tpl rename to examples/demo/site/themes/bootstrap/tpl/primary_nav.tpl diff --git a/examples/demo/site/www/themes/bootstrap/tpl/right_sidebar.tpl b/examples/demo/site/themes/bootstrap/tpl/right_sidebar.tpl similarity index 100% rename from examples/demo/site/www/themes/bootstrap/tpl/right_sidebar.tpl rename to examples/demo/site/themes/bootstrap/tpl/right_sidebar.tpl diff --git a/examples/demo/site/www/themes/bootstrap/tpl/secondary_nav.tpl b/examples/demo/site/themes/bootstrap/tpl/secondary_nav.tpl similarity index 100% rename from examples/demo/site/www/themes/bootstrap/tpl/secondary_nav.tpl rename to examples/demo/site/themes/bootstrap/tpl/secondary_nav.tpl diff --git a/examples/demo/site/www/themes/api/layout.tpl b/examples/demo/site/www/themes/api/layout.tpl deleted file mode 100644 index 6025408..0000000 --- a/examples/demo/site/www/themes/api/layout.tpl +++ /dev/null @@ -1,36 +0,0 @@ - - - - {include file="master2/head.tpl"/} - - - - - {include file="master2/site_navigation.tpl"/} - -
-
-
-
- {include file="master2/content.tpl"/} -
-
-
- - - - {if condition="$web"} - {include file="master2/optional_enhancement_js.tpl"/} - {/if} - - {if condition="$html"} - {include file="master2/optional_enhancement_js.tpl"/} - {/if} - - - - \ No newline at end of file diff --git a/examples/demo/site/www/themes/api/layout2.tpl b/examples/demo/site/www/themes/api/layout2.tpl deleted file mode 100644 index 34a5659..0000000 --- a/examples/demo/site/www/themes/api/layout2.tpl +++ /dev/null @@ -1,40 +0,0 @@ - - - - {include file="master2/head.tpl"/} - - - - - {include file="master2/site_navigation.tpl"/} - - - -
-
-
-
- {include file="master2/content.tpl"/} -
-
-
- - - - {if condition="$web"} - {include file="master2/optional_enhancement_js.tpl"/} - {/if} - - {if condition="$html"} - {include file="master2/optional_enhancement_js.tpl"/} - {/if} - - - - \ No newline at end of file diff --git a/examples/demo/site/www/themes/api/master2/basic_auth/logoff.tpl b/examples/demo/site/www/themes/api/master2/basic_auth/logoff.tpl deleted file mode 100644 index 8139dc7..0000000 --- a/examples/demo/site/www/themes/api/master2/basic_auth/logoff.tpl +++ /dev/null @@ -1,5 +0,0 @@ -

You have successfully signed out

- -You may want to return - -Press this neat little button:Take Me Home diff --git a/examples/demo/site/www/themes/api/master2/content.tpl b/examples/demo/site/www/themes/api/master2/content.tpl deleted file mode 100644 index b18c5dd..0000000 --- a/examples/demo/site/www/themes/api/master2/content.tpl +++ /dev/null @@ -1,11 +0,0 @@ - -
-

Top most recent nodes


- - - {foreach from="$nodes" item="item"} - - {/foreach} -
diff --git a/examples/demo/site/www/themes/api/master2/error.tpl b/examples/demo/site/www/themes/api/master2/error.tpl deleted file mode 100644 index 0ca7ad0..0000000 --- a/examples/demo/site/www/themes/api/master2/error.tpl +++ /dev/null @@ -1,18 +0,0 @@ -

Error: {$code/}

- -{assign name="status400" value="400"/} -{assign name="status404" value="404"/} -{assign name="status500" value="500"/} - -{if condition="$code ~ $status500"} -

Internal server error, for the request {$request/}

-{/if} - - -{if condition="$code ~ $status404"} -

Resourse not found, for the request {$request/}

-{/if} - -{if condition="$code ~ $status400"} -

Bad request, the request {$request/} is not valid

-{/if} \ No newline at end of file diff --git a/examples/demo/site/www/themes/api/master2/footer.tpl b/examples/demo/site/www/themes/api/master2/footer.tpl deleted file mode 100644 index 11fe183..0000000 --- a/examples/demo/site/www/themes/api/master2/footer.tpl +++ /dev/null @@ -1,7 +0,0 @@ - -
-

API Documentation     - Questions? Comments? Let us know!

-

© Copyright 2014 Eiffel Software -- Privacy Policy -

-
\ No newline at end of file diff --git a/examples/demo/site/www/themes/api/master2/head.tpl b/examples/demo/site/www/themes/api/master2/head.tpl deleted file mode 100644 index 4ba4616..0000000 --- a/examples/demo/site/www/themes/api/master2/head.tpl +++ /dev/null @@ -1,10 +0,0 @@ - - -Eiffel RESTonCMS -{if condition="$web"} - {include file="master2/optional_styling_css.tpl"/} -{/if} -{if condition="$html"} - {include file="master2/optional_styling_css.tpl"/} -{/if} - diff --git a/examples/demo/site/www/themes/api/master2/header.tpl b/examples/demo/site/www/themes/api/master2/header.tpl deleted file mode 100644 index ce8ec71..0000000 --- a/examples/demo/site/www/themes/api/master2/header.tpl +++ /dev/null @@ -1,2 +0,0 @@ -

RESTonCMS

-

Tagline

\ No newline at end of file diff --git a/examples/demo/site/www/themes/api/master2/main_navigation.tpl b/examples/demo/site/www/themes/api/master2/main_navigation.tpl deleted file mode 100644 index 88365d7..0000000 --- a/examples/demo/site/www/themes/api/master2/main_navigation.tpl +++ /dev/null @@ -1,5 +0,0 @@ - \ No newline at end of file diff --git a/examples/demo/site/www/themes/api/master2/optional_enhancement_js.tpl b/examples/demo/site/www/themes/api/master2/optional_enhancement_js.tpl deleted file mode 100644 index 1353b83..0000000 --- a/examples/demo/site/www/themes/api/master2/optional_enhancement_js.tpl +++ /dev/null @@ -1,5 +0,0 @@ - - -{if condition="$web"} - -{/if} \ No newline at end of file diff --git a/examples/demo/site/www/themes/api/master2/optional_styling_css.tpl b/examples/demo/site/www/themes/api/master2/optional_styling_css.tpl deleted file mode 100644 index f56d770..0000000 --- a/examples/demo/site/www/themes/api/master2/optional_styling_css.tpl +++ /dev/null @@ -1,9 +0,0 @@ -{if condition="$html"} - - - -{/if} -{if condition="$web"} - - -{/if} diff --git a/examples/demo/site/www/themes/api/master2/site_navigation.tpl b/examples/demo/site/www/themes/api/master2/site_navigation.tpl deleted file mode 100644 index 081d0f4..0000000 --- a/examples/demo/site/www/themes/api/master2/site_navigation.tpl +++ /dev/null @@ -1,27 +0,0 @@ - - - - \ No newline at end of file diff --git a/examples/demo/site/www/themes/api/modules/navigation.tpl b/examples/demo/site/www/themes/api/modules/navigation.tpl deleted file mode 100644 index ee2d15e..0000000 --- a/examples/demo/site/www/themes/api/modules/navigation.tpl +++ /dev/null @@ -1,8 +0,0 @@ -{if isset="$user"} - Logoff -{/if} -{unless isset="$user"} - Login - Register -{/unless} -List of Nodes diff --git a/examples/demo/site/www/themes/api/modules/node.tpl b/examples/demo/site/www/themes/api/modules/node.tpl deleted file mode 100644 index 815d55c..0000000 --- a/examples/demo/site/www/themes/api/modules/node.tpl +++ /dev/null @@ -1,174 +0,0 @@ -{if condition="html"} - - - - {include file="master2/head.tpl"/} - - -{/if} - -{unless condition="$web"} - - {include file="master2/site_navigation.tpl"/} -{/unless} - - -{if condition="html"} - -
-
-
-
-{/if} - - -
- {if condition="$web"} - - {/if} - {if condition="$html"} - - {/if} -
-
- {if isset="$node"} -
-
-
-
-

{$node.title/}

-
-
-
{$node.content/}
-
-
-
- {/if} -
- -
- {if isset="$user"} -
-
-
- {if isset="$node"} - -
- {/if} -
-
-
- {if isset="$user"} -
-
- - {if isset="$node"} -
- -
- Delete Node - -
- -
-
-
- {/if} -
- {/if} -
-
-
- -{if condition="html"} -
-
-
-{/if} - - -{if condition="html"} - - - - {include file="master2/optional_enhancement_js.tpl"/} - - - -{/if} \ No newline at end of file diff --git a/examples/demo/site/www/themes/api/modules/node_content.tpl b/examples/demo/site/www/themes/api/modules/node_content.tpl deleted file mode 100644 index c1353aa..0000000 --- a/examples/demo/site/www/themes/api/modules/node_content.tpl +++ /dev/null @@ -1,70 +0,0 @@ -{if condition="html"} - - - - {include file="master2/head.tpl"/} - - -{/if} - -{unless condition="$web"} - - {include file="master2/site_navigation.tpl"/} -{/unless} - -{if condition="html"} - -
-
-
-
-{/if} - - -
-
-
- -
- Edit Node Content - -
-
- -
-
- -
-
- -
- -
-
-
-
-
-{if condition="html"} - -
-
-
-{/if} - - -{if condition="html"} - - - - {include file="master2/optional_enhancement_js.tpl"/} - - - -{/if} \ No newline at end of file diff --git a/examples/demo/site/www/themes/api/modules/node_summary.tpl b/examples/demo/site/www/themes/api/modules/node_summary.tpl deleted file mode 100644 index b9022e6..0000000 --- a/examples/demo/site/www/themes/api/modules/node_summary.tpl +++ /dev/null @@ -1,71 +0,0 @@ -{if condition="html"} - - - - {include file="master2/head.tpl"/} - - -{/if} - - - {unless condition="$web"} - - {include file="master2/site_navigation.tpl"/} - {/unless} - -{if condition="html"} - -
-
-
-
-{/if} - -
-
-
- -
- Edit Node Summary - -
-
- -
-
- -
-
- -
- -
-
-
-
-
- -{if condition="html"} - -
-
-
-{/if} - - -{if condition="html"} - - - - {include file="master2/optional_enhancement_js.tpl"/} - - - -{/if} \ No newline at end of file diff --git a/examples/demo/site/www/themes/api/modules/node_title.tpl b/examples/demo/site/www/themes/api/modules/node_title.tpl deleted file mode 100644 index bf8a77e..0000000 --- a/examples/demo/site/www/themes/api/modules/node_title.tpl +++ /dev/null @@ -1,70 +0,0 @@ -{if condition="html"} - - - - {include file="master2/head.tpl"/} - - -{/if} - - {unless condition="$web"} - - {include file="master2/site_navigation.tpl"/} - {/unless} - - -{if condition="html"} - -
-
-
-
-{/if} - -
-
-
- -
- Edit Node Title - -
-
- -
-
- -
-
- -
- -
-
-
-
-
-{if condition="html"} - -
-
-
-{/if} - - -{if condition="html"} - - - - {include file="master2/optional_enhancement_js.tpl"/} - - - -{/if} \ No newline at end of file diff --git a/examples/demo/site/www/themes/api/modules/nodes.tpl b/examples/demo/site/www/themes/api/modules/nodes.tpl deleted file mode 100644 index 23b24c7..0000000 --- a/examples/demo/site/www/themes/api/modules/nodes.tpl +++ /dev/null @@ -1,52 +0,0 @@ -{if condition="html"} - - - - {include file="master2/head.tpl"/} - - -{/if} - -{unless condition="$web"} - - {include file="master2/site_navigation.tpl"/} -{/unless} - -{if condition="html"} - -
-
-
-
-{/if} -
-

List nodes


- - - {foreach from="$nodes" item="item"} - - {/foreach} -
- -{if condition="html"} -
-
-
-{/if} - - -{if condition="html"} - - - - {include file="master2/optional_enhancement_js.tpl"/} - - - -{/if} \ No newline at end of file diff --git a/examples/demo/site/www/themes/api/modules/register.tpl b/examples/demo/site/www/themes/api/modules/register.tpl deleted file mode 100644 index 3a14667..0000000 --- a/examples/demo/site/www/themes/api/modules/register.tpl +++ /dev/null @@ -1,100 +0,0 @@ -{if condition="html"} - - - - {include file="master2/head.tpl"/} - - -{/if} - - -{unless condition="$web"} - - {include file="master2/site_navigation.tpl"/} -{/unless} - -{if condition="html"} - -
-
-
-
-{/if} - - -
-
-
-
- Register -
-

Register new user

-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
- s
- -
- -
-
-
-
-
- -{if condition="html"} -
-
-
-{/if} - - -{if condition="html"} - - - - {include file="master2/optional_enhancement_js.tpl"/} - - - -{/if} \ No newline at end of file diff --git a/examples/demo/site/www/themes/api/theme.info b/examples/demo/site/www/themes/api/theme.info deleted file mode 100644 index 54b5f6e..0000000 --- a/examples/demo/site/www/themes/api/theme.info +++ /dev/null @@ -1,9 +0,0 @@ -name=api -engine=smarty -author=jvelilla -version=0.1 -regions[header] = Header -regions[content] = Content -regions[footer] = Footer -regions[first_sidebar] = first sidebar -regions[second_sidebar] = second sidebar diff --git a/examples/demo/site/www/themes/bootstrap.7z b/examples/demo/site/www/themes/bootstrap.7z deleted file mode 100644 index 45c941decd6106e4b114e1d7b783924de174214d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2576 zcmV+r3h(tddc3bE8~_8R1VBj52><{90000Z0000000002DVy5>9tcGS(C?@y7g^b< z_3Ec3KE-SU+(51|DEj{Jb*Xm>EK3AK#$20c(M9hS4eBCS$#-k2m@!U0u)?St?(5l? z+J#Qq(R0L!^oXpcSq(LVJ2>W+I%noD=J}g@+KVUX-oB)0#YL*xY7M6Y8y@#j+lS8J zuQ_u<%)3{4^zTxPUcfXA&9na84S!S*mH9R3Pbn9zfC7_T;bHyBM5BXrb+JQvyQSP- zvJmD{7XiIlwe!$*9RO@KTl_d8DhnY2&zeN%F?$2tz2c-$@gHfJFWRqToojIi$1hh0 z($Eh&<=G${%Gk)p6At9TQ}~j^b$&peJ1K?k;S_yX{4?uP5MaAWf|Q1v+0j%~7wKGg zMv(Rr2(z{BoWa-dCdz)JmPk6MK^;SkUVRaYz-})p>|%;FkpyLskBaniTjlO`j}2`k z9m_Y987gMNtR&_^445k+Cr$kP&x6m)y96Q2p#5TBnfjcNj*>_Wkne!iJmI2?b9&6iXtg+mU6Q=BYXGwHitJY_Q6 zF=s%r%Za15gSU3fr(01CYuhrD<54l+jeprX)GY{BSN#3~Xc_Nqy&ndZI0n|WL`0WI z_ExbN2!?_dt-Tom&!Vy%QZ7#r7c&a!yESMPk%}sJwOrjt%gAp;fv-C>Rq$RQ0+Qmg0X4%i!~Zg)Tx5Wk_};uyp0H_IhGAfm^4t? zzk{Kl!#U<}J!}sS33yyyLJWQ`eYIOkcxW&kDn?9-Z@YtAh&&qvNt(4HPAasE`t4Tt zO51jPn6fK~9)#RKGmf!Q5~I=BH!#>TMqR}}D-18`-tSx^lhPqRWr1Uq!wa_7L7t3g zi%sGU=1;4#_hhtTcb$2BFk8mId>A! zZtS8edApwPczvAXv(Uq%26{bY`tCJY-o#%FFYHK>&2;s@U*RgIfmBLw_07ASn3Vk-LQ6GlDOit{9Bs8ve7w$nGg z+06rSY(bWq2|JSp)s5o1bz&#Ige8f+*m=7htIi`e=0VHrMjLV_6$YN!!i&zIGrD=e znNWFLAk<}(l%a{^oAev3$y_i3cJm{jPIuUmZX{X8I26I>UK9;=H<@2H?_1}epO}Zy z1Hh!>FX7i=*S;zCqI(MVPb+0oHZIj$45Wtow(c|b7405Ig&5GIo!QK#qNZx+HdrW3 z-d0Y8#>0f){eK#3jtJx89}y9-D>{vul^H7A1Mw8kxn-@(<+Gi3tHeCK6}k`WOG*wz zB;}al36%cYEO(^0s18z27ZOJ~3!uNQTors?EwSm((|RY+ysUbqBw>{^1jAbVvpbaW zr8~9uX%TBn%U>n1a@rAes`-KnU@- zPKbM)Iv%uTQMn+Vt;0We5P2M7cAUjvg-;-H3#NkZ&9q(fVN$n?v|=8N`XH9O&v79x z!e)>z4Hfuw_sj>8d~*vakZd}rAuT2KILntbZ*PL^t1RA58_|D-rH{q1$(G46kH<28 z?S8MpAQI`uwK~OYpyHS^QIPYs#dxHRZ#(D2U?oo3;W4+$_Mt^nxmAcfCc=Rx9ZTty zb0m&Z#+Zk@sXNi&;(^tDbRM(~RzLH{BoTVbj_$(3)()znx2Ogp61R=com%-@DRlX> zmm!IwR~PiOz(6%-YQ#NmiH$$xWb+HVs{GvAQP?xH_r&d?hK7~{9qh}r@I%v6v)`oNUOvW;}Xy{H7e=_furW6bm!L8U^OCydyt*3m1)Ct?fX6HXL zs{4e;w0e(Oq;klui%08`K5j~Cn1!d`wi_I?I9JLUZei6yA%upS2Twyp(1C1P zq!GRjXNNT8h6N&6PUDq6){*ZsK)VDfnH-8^;zInzYZdkw+b*=5!o7jhi>f}0M9!(u z`bhgi1U3^L2A$^FIzPnt_4WANUW&pS|KF)mXpmHf=Ttb{!xK2%-&F}(%=1D%RJGsS z3gVVa@C8r2X@;w(s7W9j36^5!E6CFKegDOKEJ7(=v{ENfQ8tivcZ(Bkh&6qfwB}NbVUh`gdU7=R$>F+}% zjqnqs2|ESrfTC7pVcNiRz(Y2EpCs1%tFp}9n4C8EV;c`kB5u#TzH4XhL+U0{iJ3F; zG01kCi9Jr+5F8zTAGrOP0yL!SepAgqP9@P2%a|cl-q&cW^JiQxz6V-3S*IR_E8PRO z{pd28_!6_GS#3L6VTvdqxC>5#mZP(x=GP_%P@>k4QFir;Nlq8%w&ulFbKdRlH19-mOASNM$okJeo_q0u_#K6`;ZAD({SK&z?CQ`p0p= zk-q#b5~`&B!jSSI$=Xth7oC5NEd4z>-^>t4lPNR}8nw-~K{Pd*25BHIXgS`#cr(y7 zxR1hG-pwq}12jZE1{doT(3X;x5a%PiFMj8{?YHiT$^v^Qa{0MTZKgmjn>Hq=GTi9k z8}Fq#qUbsWQv*Mf%=-X*si1{Zs`Ba*TwnjNlKT~=kof6TDRWZoM^xGrgQCJwp?dZj z1oAvUq)|NAy>queF?Vbw(+FUFTbB?=ccjbhhRLLzCQgy3+IEGy305p6qe?5zXqoo8 zotTxAh36SEeGT*iE^I!`!{wRlrO85ME8yodrqgs|^hO19UR!Ay;}nhbWmli$a!fps zMo`?!0i2*V?mt=$ByAiHciIIvp)UFuYtbzFQg>(&I_GXA-K9}c74s)6WAbsJqCQ6H m7Y2w`0SSS400#>J00AQd0RaVF01yBG41@;?0cX3}!2kek%Il&4 diff --git a/examples/demo/site/www/themes/bootstrap/page.tpl b/examples/demo/site/www/themes/bootstrap/page.tpl deleted file mode 100644 index 53f29fd..0000000 --- a/examples/demo/site/www/themes/bootstrap/page.tpl +++ /dev/null @@ -1,84 +0,0 @@ - - - - - ROC- Layout with defualt Regions - - - - - - - - - - - - - - - - -{$head_title/} - - - - {if isset="$region_top"} - {$region_top/} - {/if} - -
- - - - - -
- - {unless empty="$page.region_sidebar_first"} -
- {$page.region_sidebar_first/} -
- {/unless} - - - -
- - {$page.region_highlighted/} - - - {$page.region_help/} - - - {unless empty="$page_title"}

{$page_title/}

{/unless} - {$page.region_content/} -
- - - {unless empty="$page.region_sidebar_second"} -
- {$page.region_sidebar_second/} -
- {/unless} - -
-
- - - {$page.region_footer/} - - - {$page.region_bottom/} - - - - diff --git a/examples/demo/site/www/themes/bootstrap/roc_template -2.html b/examples/demo/site/www/themes/bootstrap/roc_template -2.html deleted file mode 100644 index 17b8074..0000000 --- a/examples/demo/site/www/themes/bootstrap/roc_template -2.html +++ /dev/null @@ -1,108 +0,0 @@ - - - - - ROC- Layout with defualt Regions - - - - - - - - -ROC CMS - A responsive layout - - - - -
-

ROC Layout with Defaul Regions

- - - -
- - - - - - - -
-

Highlighted Section

-

Help Section

- -

Main Content Section

-

Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum.

- -

Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare quam littera gothica, quam nunc putamus parum claram, anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes in futurum.

-
- - - -
-
- - - - - - - - - diff --git a/examples/demo/site/www/themes/bootstrap/roc_template.html b/examples/demo/site/www/themes/bootstrap/roc_template.html deleted file mode 100644 index 1472f38..0000000 --- a/examples/demo/site/www/themes/bootstrap/roc_template.html +++ /dev/null @@ -1,135 +0,0 @@ - - - - - ROC- Layout with defualt Regions - - - - - - - - - - - - - - - - -ROC CMS - A responsive layout - - - - - -
- - - -
- - - - - - - -
-

Highlighted Section

-

Help Section

- -

Main Content Section

-

Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum.

- -

Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare quam littera gothica, quam nunc putamus parum claram, anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes in futurum.

-
- - - - - -
-
- - - - - - - - - diff --git a/examples/demo/site/www/themes/smarty/front-page.tpl b/examples/demo/site/www/themes/smarty/front-page.tpl deleted file mode 100644 index ae932ee..0000000 --- a/examples/demo/site/www/themes/smarty/front-page.tpl +++ /dev/null @@ -1,12 +0,0 @@ -{include file="tpl/page-header.tpl"/} -
-
- -
- Welcome ... this is the front page - {if isset="$content"}{$content/}{/if} -
- -
-
-{include file="tpl/page-footer.tpl"/} diff --git a/examples/demo/site/www/themes/smarty/page.tpl b/examples/demo/site/www/themes/smarty/page.tpl deleted file mode 100644 index 5dde43c..0000000 --- a/examples/demo/site/www/themes/smarty/page.tpl +++ /dev/null @@ -1,11 +0,0 @@ -{include file="tpl/page-header.tpl"/} -
-
- -
- {if isset="$content"}{$content/}{/if} -
- -
-
-{include file="tpl/page-footer.tpl"/} diff --git a/examples/demo/site/www/themes/smarty/res/ewfcms.js b/examples/demo/site/www/themes/smarty/res/ewfcms.js deleted file mode 100644 index d4ebbef..0000000 --- a/examples/demo/site/www/themes/smarty/res/ewfcms.js +++ /dev/null @@ -1,91 +0,0 @@ -/* - * EWF CMS javascript based on JQuery - */ - -/** - * Override jQuery.fn.init to guard against XSS attacks. - * - * See http://bugs.jquery.com/ticket/9521 - */ - -(function () { - var jquery_init = jQuery.fn.init; - jQuery.fn.init = function (selector, context, rootjQuery) { - // If the string contains a "#" before a "<", treat it as invalid HTML. - if (selector && typeof selector === 'string') { - var hash_position = selector.indexOf('#'); - if (hash_position >= 0) { - var bracket_position = selector.indexOf('<'); - if (bracket_position > hash_position) { - throw 'Syntax error, unrecognized expression: ' + selector; - } - } - } - return jquery_init.call(this, selector, context, rootjQuery); - }; - jQuery.fn.init.prototype = jquery_init.prototype; -})(); - - -var EWFCMS = EWFCMS || { }; - -EWFCMS.toggleFieldset = function(fieldset) { - if ($(fieldset).is('.collapsed')) { - var content = $('> div:not(.action)', fieldset); - $(fieldset).removeClass('collapsed'); - content.hide(); - content.slideDown( { - duration: 'fast', - easing: 'linear', - complete: function() { - //Drupal.collapseScrollIntoView(this.parentNode); - this.parentNode.animating = false; - $('div.action', fieldset).show(); - }, - step: function() { - // Scroll the fieldset into view - //Drupal.collapseScrollIntoView(this.parentNode); - } - }); - } else { - var content = $('> div:not(.action)', fieldset).slideUp('fast', function() { - $(this.parentNode).addClass('collapsed'); - this.parentNode.animating = false; - }); - } - }; - -jQuery(document).ready(function(){ - //$('.collapsed').hide(); - $('fieldset.collapsible > legend').each(function() { - var fieldset = $(this.parentNode); - // turn legen into clickable link and wrap contents - var text = this.innerHTML; - $(this).empty() - .append($(''+ text + '').click(function() { - var fieldset = $(this).parents('fieldset:first')[0]; - if (!fieldset.animating) { - fieldset.animating = true; - EWFCMS.toggleFieldset(fieldset); - } - return false; - } - )) - .after($('
') - .append(fieldset.children(':not(legend):not(.action)'))) - .addClass('collapse-processed'); - }); - $('fieldset.collapsed').each(function() { - $(this).removeClass('collapsed'); - EWFCMS.toggleFieldset(this); - }); -}); - -jQuery(document).ready(function(){ - $('#tabs').tabs(); -}); - -//jQuery(document).ready(function(){ - //$('#second_sidebar').hide(); -//}); - diff --git a/examples/demo/site/www/themes/smarty/res/favicon.ico b/examples/demo/site/www/themes/smarty/res/favicon.ico deleted file mode 100644 index 343067f9fc7b0829212336f7f67fa96328ba71a3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 786 zcmV+t1MU0(0096201yxW0096X0Q>>~02TlM0EtjeM-2)Z3IG5A4M|8uQUCw|5C8xG z5C{eU001BJ|6u?C0>eo}K~y-)rITAo({U8XKfnL}o7;5Gf7`#NrbcCZOZiN?Bp`q9v&rArV=Mld@&Dx&PKSEvK3Odzg!e zdg==Y&VlnioXhtJ{y^)!D+Qj;_Oh_%%bysJ<^fo3_I^c8?_0KhQ`6SsL$80&7YRq# zb#dK&yr#S5R<$jsp}U>;>vzx2%kf@ zM}q!Xb8AIj|+G1a}*ss!q;$!u9gNI=~);}Nn|WuPWQtmEGag2R2(H5 z3NY+>%k|po(4MN(TVzjXdzm)kb-1#Z@a91;2P!kRBXF{9OHCrxz`4UXc>%)w-~5YhasShJar1HA|#NK;+d z6ej>-&6h7HPSxMj!LGwqAOt3h72l8tAxZd#Jh&DuB@!Iv+gOBp_laLiofwbi$%)`; z^EJW)FG#g3jQhP@J9&Vw(-Mozt@+e#{WR~MDKqtg;aSx~(aa#Q0)2BUG}^lZF?d<9f9#AXDmi%Q+wN-BEAFDV}@ zZyxPvD3+Ne5QAi6ybF^AsiyeiTvnJ75(_r$yB$0D_Y3q952X)P+y6pC29P$?E$7oY+GgzT9tlVmapStr|M zoB7>8CbMOhYhGiQFk_kEuCeZKGeJn#AwL{a1hA*#2t{l1>Awq>H#mSC~;DTn&| zl|z<(6@XkBG9V8Lu_%?H79mK|8Xgt*Nmz935uocvR4&YrNJ_iW@MvF8_ub94mFh44 zdO%%y>8z}`yCa}dSY!-2`HM$xU%TF<$;dHdSste&O?i z(}(_`sVymkcHOWNn#9 zb|NCG)_VO1MXzqZ?d- zgmWhjhnzcc=+XA(#=`M=<6|WH+S$_=UU+0hh9e>$RP3a8#}s|$&YO#tBJ{@-C89U(@YOu@2M zNM*qYg7*mj&m;R7=r!~F{(scYUA+7jpwpQtilXypGU)ehz9ZLme+J_H8Hf++WMcJ| zFU3H3cjr&VKmOuL=ldUa{6uu4%-QBfP>#h~AFzU;lP4TUj_mP#iaDonp`tmET zLUQu}kOj+GQTQWgx?HJZ*#l1i5Ti~eG%^|hL-|(#tlGF0S+IP8;hL}uBE#3!et3<>j)b&yOO z`v<5WBa)b!E`sI-y_;=9{T;g-OlItc5O>an?3(cb(-$`?nJZ|7rw~rFg1E8 zN@c;$=Z}lt;)6F{^djQG^~O5llhaAbnTsHi5TBIp%o`l&L!k;KJ~`ck5P+e=PDCPc zImgRCUQ5}RpZcu}pu^Ni#f2~O)M+{`V3Yu~8S6KkI{2nKkfL0nA}%S->!%D22VCwY zSE@)%&2kzoiXxR4&j2{dIeHCTuH_D?EZApVK|xXvxl;$x`6c1eIpV@-u-raQ&@GFQN- z&B}B3NPBYwEe1Vc-+Lry&vwRxQD2UAbY$9filT_Ira}WmN_#uo@B94N0nJ28=8o(1 zo4t3Xeckqg+Gc{i_EgD@5k?mF(c-dM-z$go$sue8sP9nj3X z?R)o0d%D_|S6}{8HW86yZ@t9vw_ov_-_}%5e@{0d;gO`~=Alr90`{P6sndRlsdb-+{OGKM3aiTpofHq^+gfb0d!*EPu5+UJ{fW1fB zjRvgNQ2e-f=u^6K7y{^gHc{KtoY zedNkr_-&8;_T~nx)=}Dx1`<*-J@VY=pP68I$fA-CSqA(PsV}?i@xEZ`N-vr6^Pf4N zD~ivs^3kW9@1iKuSX~N0ZOJ7MBBr`3dOF*tZ@n9aECVXZ@Zg|dBE_E^=i{Qcyk=N` z`1eOgXsEpAdjH#BXs)dU;OHAWv01IoyrMncL-}+uJUFNlu6*|Qnw^i`nGr}ZEHZ|K z)J)_GZ_X_SJsmBs(;JywLH>8XPhWQ@W#>P|eOQl*SChBoPAZGfV5+b7C?{i1fpbZt zzj~e_i{D+X7oL0P@3qokguFDDY#q=GI2WIpz#hic%XM(=b0xl%PCmC02WK@jjYv&$s#vpk3h z_MtrnN9!(%hwr*gs}E$_jjc4h%KA|*M2)S~=f!}<3VW_Xa1cD52jKx`vtU1)Zb1-` z$yFAKL?W0%BV&9DMau(|aL26)<0=4dj&r^1B3vXKD2Rg~0kXmalL&;+$QUFN!6Xfj ziaVW?zxY2cp8n9Qs8F|*jv;&N8G1cs933h5;rH1QuIE{i-uY6&?yjM3i(1nFym}3c z{hqSEVh$iDfAL6oRNQGvSaj@>C2QB4e2clzW&yn!Mr@wHQ6CkwSnU6q;UEz_iHJa} z#eY5RgZ9Q6UyscXktJ)_o5G@Fk4S-Tb-K{UW zlC#4hH58O%u2d(kn0v7C7s^#BR2T69{T-kO_D-<$Jp|98=GS^Df_{-XE*8c7Zpb* zXtkZK#u-p>8CGS6*->^Pj@}SODC>qbK6E}d!lx}TFB;?$K!67`T`s7LfC|^y1JMau zboq;l0TZ~LG-}dwHf?xzkKe1Wpef#nI9gsC0(0yqKh*X4Z*_oSt34jhw8EJd_{6PE z$5+4M**y)K^qftOclX_VQ|8=)Q_0!0pJ=Qu6~HyLf<0*G$3XYEP1@k7Ym{z#HV+rGyaZ$l=XR>ekAH4j5+w}1IS=o*4cV`UX?-Pxv2(`{$m{i1ZdQmiJqXwm9* z`G$(Geth=C;n3YzAwSl>jtcdX21DQ2f3K@mM#o01KiAktoM<_`Q)Q0+@(zQ z>J1pwX5}v3ytnA&?Q0(D`+7{A7`Lx^sBiP$qLYD0z$CAyTN-O#K7aCq#}2;qv)CK> z?Mgrhg22Q7^PBdCcir<&Vshrw6UtBegMsG8!nUURUHe{mDy6>c%GdhAK-x|7#mArD z+YpzO_KdH<_J!$u!tt`9;_Ax%yS61cuGnrA;F!vRhQ2R)7=6H5(&Bmi^OFQJYmY3cgy)?-JG8=wtkvYIWzS6#FmDd z4VE7B+7?5#=JR8J(o|phx2&hL&F2{a*nK}dI*#o5-x^u+gNK?EQ?r|u;SqmLOv!u? zXqm1dGbQ4V(C+Ik_xAU8t+d%h^~lhGYREF6bQ}N%D-;8ArOG0cs|F+z!4wh}^-*Me f;!)s+jEMgaKSv*+{l^)l00000NkvXXu0mjf$2x5w diff --git a/examples/demo/site/www/themes/smarty/res/menu-collapsed.png b/examples/demo/site/www/themes/smarty/res/menu-collapsed.png deleted file mode 100644 index 95a214a6e6d17fee2f098804997f3826ffc9d4ca..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 108 zcmeAS@N?(olHy`uVBq!ia0vp^>>$j@3?%=}IXVGIu?6^qxc>kDAIJlF_r}R z1v5B2yO9Ruh>$j@3?%=}IXVGIu?6^qxc>kDAIJlF_r}R z1v5B2yO9Ru2zk0VhE&W+{&76uaKb@_0}N~oA{!VF-#vS9IZ&3t)78&qol`;+0EMF; ATL1t6 diff --git a/examples/demo/site/www/themes/smarty/res/style.css b/examples/demo/site/www/themes/smarty/res/style.css deleted file mode 100644 index b0615ae..0000000 --- a/examples/demo/site/www/themes/smarty/res/style.css +++ /dev/null @@ -1,251 +0,0 @@ -body { margin: 0; background-color: #eeeeff;} -div#header { background-color: #003; color: #fff; border: solid 1px #003; padding: 0px; margin: 0px;} -div#header img#logo { float: left; margin: 5px 15px 5px 10px; } -div#header div#title {font-size: 180%; font-weight: bold; margin-top: 10px; } -ul.horizontal { - list-style-type: none; -} -ul.horizontal li { - display: inline; - padding: 0 5px 0 5px; -} - -div#menu-bar li.active { - border: solid 1px #ff0; - color: #ff0; -} -div#menu-bar li:hover { - background-color: #fff; - color: #00f; -} -div#menu-bar li a { - text-decoration: none; - color: #fff; -} -div#menu-bar li:hover a { - color: #00f; - font-style: bold; -} - - -div#primary-tabs li { - color: #00f; - padding: 2px 5px 2px 5px; - background-color: #eee; - border: solid 1px #ccf; -} -div#primary-tabs li.active { - padding: 2px 7px 1px 7px; - border-top: solid 2px #99f; - border-left: solid 1px #99f; - border-right: solid 1px #99f; - border-bottom: 0; - background-color: #fff; - color: #00f; -} -div#primary-tabs li:hover { - background-color: #fff; - color: #00f; -} -div#primary-tabs li a { - text-decoration: none; - color: #00f; -} -div#primary-tabs li:hover a { - color: #00f; - font-style: bold; -} - - - -div#menu-first { margin-left: 20%; color: #ccf; background-color: #003; } -div#menu-first a { color: #ccf; } -div#menu-second { color: #99f; background-color: #333; } -div#menu-second a { color: #99f; } - -div#main-wrapper { - clear: both; - display: block; - height: 0; -} -div#main { margin: 0; padding: 0; clear: both; height:0; display: block; } - -div#content { - padding: 5px 3px 5px 20px; - margin-top: 10px; - min-width: 60%; - display: inline; - float: left; - position: relative; - background-color: #ffffff; - padding-bottom: 30px; -} - -div#first_sidebar { - width: 20%; - margin: 5px; - padding: 5px; - display: inline; - float: left; - position: relative; -} -div#second_sidebar { - width: 20%; - margin: 5px; - padding: 5px; - display: inline; - float: left; - position: relative; - background-color: #eee; -} -div.sidebar div.block { - margin-bottom: 5px; - padding: 0; - border: dotted 1px #999; - background-color: #fff; -} -div.sidebar div.block div.title { - padding: 3px 3px 3px 3px; - font-weight: bold; - background-color: #dedede; - border-bottom: dotted 1px #999; -} -div.sidebar div.block div.inside { - margin: 3px; -} -div#footer { margin: 10px 0 10px 0; clear: both; display: block; text-align: center; padding: 10px; border-top: solid 1px #00f; color: #fff; background-color: #333;} -div#footer a { color: #ff0; } - -form div.error { - border-top: dotted 1px #f00; - border-bottom: dotted 1px #f00; - border-left: solid 3px #f00; -} -div.node div.title { - font-weight: bold; - font-size: 110%; - border-bottom: dotted 1 px #009; -} -div.description { - font-style: italic; - font-color: #999; -} - -div.node-wrapper { - margin: 5px 2px 5px 2px; - border: dotted 1px #dddddd; - padding: 5px 3px 5px 3px; -} -div.node div.title { - font-weight: bold; - font-size: 110%; - border-bottom: dotted 1 px #009; - float: left; -} -div.node div.description { - text-align: right; -} -div.node div.inner { - padding: 5px 5px 5px 10px; - border-top: dotted 1px #dddddd; -} - -form#user-login { - border: dotted 1px #099; - display: inline-block; - padding: 10px; - margin: 10px; -} - -form#user-login>div { - margin-bottom: 10px; -} -form#user-login .input { - float: left; -} -form#user-login img.logo { -} - -div#message { - border: solid 1px #fc0; - background-color: #fed; - color: #000; - padding: 5px; - margin: 5px; -} - -div#message li { - padding-left: 5px; - margin-left: 3px; -} -div#message li.success { - color: #003300; - background-color: #ccffcc; -} - -div#message li.error { - color: #330000; - background-color: #ff9494; -} -div#message li.warning { - color: #aa2200; - background-color: #ffcc99; -} - -div.columns { - margin-top: 10px; - display: inline-block; - clear: both; -} - -div.columns>* { - padding-left: 10px; - padding-top: 5px; - border-top: dotted 1px #999; - border-left: dotted 1px #999; - margin-left: 1px; - margin-right: 10px; - float: left; -} - -/* Link */ - -a { - text-decoration: none; -} -a:hover { - text-decoration: underline; -} - -div.menu ul.vertical { - margin: 0; - padding-left: 10px; - list-style-type: none; -} - -div.menu ul.vertical ul { - border-left: solid 3px #eee; - list-style-type: none; - margin: 0; - padding-left: 5px; - margin-left: 5px; - margin-bottom: 5px; -} - -/* Fieldset and collapsible */ - -fieldset.collapsible legend a { - padding-left: 15px; - background: url(menu-expanded.png) 5px 75% no-repeat; -} - -fieldset.collapsed legend a { - padding-left: 15px; - background: url(menu-collapsed.png) 5px 50% no-repeat; -} - -fieldset.collapsed { - border: none; - border-top: dotted 1px #000; -} - diff --git a/examples/demo/site/www/themes/smarty/theme.info b/examples/demo/site/www/themes/smarty/theme.info deleted file mode 100644 index 38a712a..0000000 --- a/examples/demo/site/www/themes/smarty/theme.info +++ /dev/null @@ -1,10 +0,0 @@ -name=smarty -engine=smarty -author=jfiat -version=0.1 -;template_dir=templates -regions[header] = Header -regions[content] = Content -regions[footer] = Footer -regions[first_sidebar] = first sidebar -regions[second_sidebar] = second sidebar diff --git a/examples/demo/site/www/themes/smarty/tpl/page-footer.tpl b/examples/demo/site/www/themes/smarty/tpl/page-footer.tpl deleted file mode 100644 index 693215b..0000000 --- a/examples/demo/site/www/themes/smarty/tpl/page-footer.tpl +++ /dev/null @@ -1,6 +0,0 @@ - - - -{if isset="$page_bottom"}{$page_bottom/}{/if} - - diff --git a/examples/demo/site/www/themes/smarty/tpl/page-header.tpl b/examples/demo/site/www/themes/smarty/tpl/page-header.tpl deleted file mode 100644 index c8eba5a..0000000 --- a/examples/demo/site/www/themes/smarty/tpl/page-header.tpl +++ /dev/null @@ -1,14 +0,0 @@ - - - -{if isset="$head"}{$head/}{/if} -{$head_title/} -{if isset="$styles"}{$styles/}{/if} -{if isset="$scripts"}{$scripts/}{/if} -{if isset="$head_lines"}{$head_lines/}{/if} - -
-
- diff --git a/examples/demo/src/ewf_roc_server.e b/examples/demo/src/ewf_roc_server.e index 9de8b74..a8fe186 100644 --- a/examples/demo/src/ewf_roc_server.e +++ b/examples/demo/src/ewf_roc_server.e @@ -2,8 +2,8 @@ note description: "[ application service ]" - date: "$Date: 2015-02-05 10:25:53 +0100 (jeu., 05 févr. 2015) $" - revision: "$Revision: 96584 $" + date: "$Date: 2015-02-09 22:29:56 +0100 (lun., 09 févr. 2015) $" + revision: "$Revision: 96596 $" class EWF_ROC_SERVER @@ -136,8 +136,10 @@ feature -- CMS setup m: CMS_MODULE do create {BASIC_AUTH_MODULE} m.make - m.enable - a_setup.register_module (m) + if not a_setup.module_with_same_type_registered (m) then + m.enable + a_setup.register_module (m) + end create {CMS_DEMO_MODULE} m.make m.enable diff --git a/library/layout/src/configuration/database_configuration.e b/library/layout/src/configuration/database_configuration.e index 4d7de25..3d28d5b 100644 --- a/library/layout/src/configuration/database_configuration.e +++ b/library/layout/src/configuration/database_configuration.e @@ -1,7 +1,7 @@ note description: "Object that represent Database configuration settings" - date: "$Date: 2015-01-27 19:15:02 +0100 (mar., 27 janv. 2015) $" - revision: "$Revision: 96542 $" + date: "$Date: 2015-02-09 22:29:56 +0100 (lun., 09 févr. 2015) $" + revision: "$Revision: 96596 $" class DATABASE_CONFIGURATION @@ -33,7 +33,7 @@ feature -- Access connection_string: READABLE_STRING_32 -- Connection string do - Result := "Driver={" + driver + "};" + database_string + Result := {STRING_32} "Driver={" + driver + {STRING_32} "};" + database_string end item (a_param: READABLE_STRING_GENERAL): detachable READABLE_STRING_32 diff --git a/library/model/cms_model-safe.ecf b/library/model/cms_model-safe.ecf index e8efe8c..db1d7ee 100644 --- a/library/model/cms_model-safe.ecf +++ b/library/model/cms_model-safe.ecf @@ -5,8 +5,8 @@ - + diff --git a/library/model/cms_model.ecf b/library/model/cms_model.ecf index 77c32a2..5e20c98 100644 --- a/library/model/cms_model.ecf +++ b/library/model/cms_model.ecf @@ -5,8 +5,8 @@ - + diff --git a/library/model/src/link/cms_link.e b/library/model/src/link/cms_link.e index a16b86c..7906d70 100644 --- a/library/model/src/link/cms_link.e +++ b/library/model/src/link/cms_link.e @@ -2,18 +2,29 @@ note description: "[ Abstraction to represent a URI link in the CMS system. ]" - date: "$Date$" - revision: "$Revision$" + date: "$Date: 2015-02-09 22:29:56 +0100 (lun., 09 févr. 2015) $" + revision: "$Revision: 96596 $" deferred class CMS_LINK inherit REFACTORING_HELPER + undefine + is_equal + end DEBUG_OUTPUT + undefine + is_equal + end ITERABLE [CMS_LINK] + undefine + is_equal + end + + COMPARABLE feature -- Access @@ -23,6 +34,21 @@ feature -- Access location: READABLE_STRING_8 -- Associated url location. + weight: INTEGER + -- Optional weight used for order. + +feature -- Comparison + + is_less alias "<" (other: like Current): BOOLEAN + -- Is current object less than `other'? + do + if weight = other.weight then + Result := title < other.title + else + Result := weight < other.weight + end + end + feature -- status report is_active: BOOLEAN @@ -53,6 +79,16 @@ feature -- status report deferred end +feature -- Element change + + set_weight (a_weight: INTEGER) + -- Set `weight' to `a_weight'. + do + weight := a_weight + ensure + weight_set: weight = a_weight + end + feature -- Query parent: detachable CMS_LINK @@ -84,9 +120,12 @@ feature -- Status report create Result.make_from_string (title) Result.append_string_general (" -> ") Result.append_string_general (location) + Result.append_string_general (" [") + Result.append_integer (weight) + Result.append_string_general ("]") end note - copyright: "2011-2014, Javier Velilla, Jocelyn Fiat, Eiffel Software and others" + copyright: "2011-2015, Javier Velilla, Jocelyn Fiat, Eiffel Software and others" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" end diff --git a/library/model/src/link/cms_link_composite.e b/library/model/src/link/cms_link_composite.e index c4cdc2c..2c45636 100644 --- a/library/model/src/link/cms_link_composite.e +++ b/library/model/src/link/cms_link_composite.e @@ -2,8 +2,8 @@ note description: "[ Abstraction to represent a links container in the CMS system. ]" - date: "$Date$" - revision: "$Revision$" + date: "$Date: 2015-02-09 22:29:56 +0100 (lun., 09 févr. 2015) $" + revision: "$Revision: 96596 $" deferred class CMS_LINK_COMPOSITE @@ -30,6 +30,27 @@ feature -- Element change deferred end + sort + -- Sort `items' and also recursively in sub items. + local + l_sorter: QUICK_SORTER [CMS_LINK] + do + create l_sorter.make (create {COMPARABLE_COMPARATOR [CMS_LINK]}) + if attached items as lst then + l_sorter.sort (lst) + across + lst as ic + loop + if + attached {CMS_LINK_COMPOSITE} ic.item as l_composite and then + not l_composite.is_empty + then + l_composite.sort + end + end + end + end + feature -- status report is_empty: BOOLEAN @@ -47,6 +68,6 @@ feature -- status report end note - copyright: "2011-2014, Javier Velilla, Jocelyn Fiat, Eiffel Software and others" + copyright: "2011-2015, Javier Velilla, Jocelyn Fiat, Eiffel Software and others" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" end diff --git a/library/model/src/link/cms_local_link.e b/library/model/src/link/cms_local_link.e index f33c93b..db41482 100644 --- a/library/model/src/link/cms_local_link.e +++ b/library/model/src/link/cms_local_link.e @@ -2,8 +2,8 @@ note description: "[ Abstraction to represent a link to a CMS resource. ]" - date: "$Date$" - revision: "$Revision$" + date: "$Date: 2015-02-09 22:29:56 +0100 (lun., 09 févr. 2015) $" + revision: "$Revision: 96596 $" class CMS_LOCAL_LINK @@ -16,6 +16,8 @@ inherit items as children, extend as add_link, remove as remove_link + undefine + is_equal end create @@ -168,6 +170,6 @@ feature {NONE} -- Implementation invariant note - copyright: "2011-2014, Javier Velilla, Jocelyn Fiat, Eiffel Software and others" + copyright: "2011-2015, Javier Velilla, Jocelyn Fiat, Eiffel Software and others" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" end diff --git a/library/model/src/link/cms_menu.e b/library/model/src/link/cms_menu.e index 5da0bb0..ad511d0 100644 --- a/library/model/src/link/cms_menu.e +++ b/library/model/src/link/cms_menu.e @@ -3,8 +3,8 @@ note Abstraction to represent a MENU in the CMS system. It has items as sub menu/link. ]" - date: "$Date$" - revision: "$Revision$" + date: "$Date: 2015-02-09 22:29:56 +0100 (lun., 09 févr. 2015) $" + revision: "$Revision: 96596 $" class CMS_MENU @@ -61,6 +61,17 @@ feature -- Status report Result := items.is_empty end + has (lnk: CMS_LINK): BOOLEAN + do + across + items as ic + until + Result + loop + Result := ic.item.location.same_string (lnk.location) + end + end + feature -- Element change extend (lnk: CMS_LINK) @@ -91,6 +102,6 @@ feature -- Access invariant note - copyright: "2011-2014, Javier Velilla, Jocelyn Fiat, Eiffel Software and others" + copyright: "2011-2015, Javier Velilla, Jocelyn Fiat, Eiffel Software and others" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" end diff --git a/library/persistence/implementation/mysql/src/cms_storage_mysql.e b/library/persistence/implementation/mysql/src/cms_storage_mysql.e deleted file mode 100644 index 7fdfd7f..0000000 --- a/library/persistence/implementation/mysql/src/cms_storage_mysql.e +++ /dev/null @@ -1,112 +0,0 @@ -note - description: "Summary description for {CMS_STORAGE_MYSQL}." - date: "$Date: 2015-01-27 19:15:02 +0100 (mar., 27 janv. 2015) $" - revision: "$Revision: 96542 $" - -class - CMS_STORAGE_MYSQL - -inherit - CMS_STORAGE - - CMS_STORAGE_STORE_SQL - - CMS_USER_STORAGE_MYSQL - - CMS_NODE_STORAGE_MYSQL - - REFACTORING_HELPER - -create - make - ---feature {NONE} -- Initialization - --- make (a_connection: DATABASE_CONNECTION) --- -- --- require --- is_connected: a_connection.is_connected --- do --- connection := a_connection --- log.write_information (generator + ".make - is database connected? "+ a_connection.is_connected.out ) - --- create {DATABASE_HANDLER_IMPL} db_handler.make (a_connection) - --- create error_handler.make ----- error_handler.add_synchronization (db_handler.database_error_handler) --- end - --- db_handler: DATABASE_HANDLER - --- connection: DATABASE_CONNECTION --- -- Current database connection. - ---feature -- Query - --- sql_post_execution --- -- Post database execution. --- do --- error_handler.append (db_handler.database_error_handler) --- if error_handler.has_error then --- log.write_critical (generator + ".post_execution " + error_handler.as_string_representation) --- end --- end - --- sql_begin_transaction --- do --- connection.begin_transaction --- end - --- sql_commit_transaction --- do --- connection.commit --- end - --- sql_query (a_sql_statement: STRING; a_params: detachable STRING_TABLE [detachable ANY]) --- do --- check_sql_query_validity (a_sql_statement, a_params) --- db_handler.set_query (create {DATABASE_QUERY}.data_reader (a_sql_statement, a_params)) --- db_handler.execute_query --- end - --- sql_change (a_sql_statement: STRING; a_params: detachable STRING_TABLE [detachable ANY]) --- do --- check_sql_query_validity (a_sql_statement, a_params) --- db_handler.set_query (create {DATABASE_QUERY}.data_reader (a_sql_statement, a_params)) --- db_handler.execute_change --- end - --- sql_rows_count: INTEGER --- -- Number of rows for last sql execution. --- do --- Result := db_handler.count --- end - --- sql_start --- -- Set the cursor on first element. --- do --- db_handler.start --- end - --- sql_after: BOOLEAN --- -- Are there no more items to iterate over? --- do --- Result := db_handler.after --- end - --- sql_forth --- -- Fetch next row from last sql execution, if any. --- do --- db_handler.forth --- end - --- sql_item (a_index: INTEGER): detachable ANY --- do --- if attached {DB_TUPLE} db_handler.item as l_item and then l_item.count >= a_index then --- Result := l_item.item (a_index) --- else --- check has_item_at_index: False end --- end --- end - -end diff --git a/library/persistence/implementation/sqlite/src/cms_storage_sqlite.e b/library/persistence/implementation/sqlite/src/cms_storage_sqlite.e deleted file mode 100644 index 9e91049..0000000 --- a/library/persistence/implementation/sqlite/src/cms_storage_sqlite.e +++ /dev/null @@ -1,112 +0,0 @@ -note - description: "Summary description for {CMS_STORAGE_MYSQL}." - date: "$Date: 2015-01-27 19:15:02 +0100 (mar., 27 janv. 2015) $" - revision: "$Revision: 96542 $" - -class - CMS_STORAGE_SQLITE - -inherit - CMS_STORAGE - - CMS_STORAGE_STORE_SQL - - CMS_USER_STORAGE_SQLITE - - CMS_NODE_STORAGE_SQLITE - - REFACTORING_HELPER - -create - make - ---feature {NONE} -- Initialization - --- make (a_connection: DATABASE_CONNECTION) --- -- --- require --- is_connected: a_connection.is_connected --- do --- connection := a_connection --- log.write_information (generator + ".make_with_database is database connected? "+ a_connection.is_connected.out ) - --- create {DATABASE_HANDLER_IMPL} db_handler.make (a_connection) - --- create error_handler.make ----- error_handler.add_synchronization (db_handler.database_error_handler) --- end - --- db_handler: DATABASE_HANDLER - --- connection: DATABASE_CONNECTION --- -- Current database connection. - ---feature -- Access: user - --- sql_post_execution --- -- Post database execution. --- do --- error_handler.append (db_handler.database_error_handler) --- if error_handler.has_error then --- log.write_critical (generator + ".post_execution " + error_handler.as_string_representation) --- end --- end - --- sql_begin_transaction --- do --- connection.begin_transaction --- end - --- sql_commit_transaction --- do --- connection.commit --- end - --- sql_query (a_sql_statement: STRING; a_params: detachable STRING_TABLE [detachable ANY]) --- do --- check_sql_query_validity (a_sql_statement, a_params) --- db_handler.set_query (create {DATABASE_QUERY}.data_reader (a_sql_statement, a_params)) --- db_handler.execute_query --- end - --- sql_change (a_sql_statement: STRING; a_params: detachable STRING_TABLE [detachable ANY]) --- do --- check_sql_query_validity (a_sql_statement, a_params) --- db_handler.set_query (create {DATABASE_QUERY}.data_reader (a_sql_statement, a_params)) --- db_handler.execute_change --- end - --- sql_rows_count: INTEGER --- -- Number of rows for last sql execution. --- do --- Result := db_handler.count --- end - --- sql_start --- -- Set the cursor on first element. --- do --- db_handler.start --- end - --- sql_after: BOOLEAN --- -- Are there no more items to iterate over? --- do --- Result := db_handler.after --- end - --- sql_forth --- -- Fetch next row from last sql execution, if any. --- do --- db_handler.forth --- end - --- sql_item (a_index: INTEGER): detachable ANY --- do --- if attached {DB_TUPLE} db_handler.item as l_item and then l_item.count >= a_index then --- Result := l_item.item (a_index) --- else --- check has_item_at_index: False end --- end --- end - -end diff --git a/library/persistence/implementation/sqlite/src/cms_storage_sqlite_builder.e b/library/persistence/implementation/sqlite/src/cms_storage_sqlite_builder.e deleted file mode 100644 index 3dcbb30..0000000 --- a/library/persistence/implementation/sqlite/src/cms_storage_sqlite_builder.e +++ /dev/null @@ -1,43 +0,0 @@ -note - description: "[ - Objects that ... - ]" - author: "$Author: jfiat $" - date: "$Date: 2015-01-27 19:15:02 +0100 (mar., 27 janv. 2015) $" - revision: "$Revision: 96542 $" - -class - CMS_STORAGE_SQLITE_BUILDER - -inherit - CMS_STORAGE_BUILDER - -create - make - -feature {NONE} -- Initialization - - make - -- Initialize `Current'. - do - end - -feature -- Factory - - storage (a_setup: CMS_SETUP): detachable CMS_STORAGE_SQLITE - local - s: STRING - do - if attached (create {APPLICATION_JSON_CONFIGURATION_HELPER}).new_database_configuration (a_setup.layout.application_config_path) as l_database_config then - s := "Driver=SQLite3 ODBC Driver;Database=" - if attached l_database_config.database_name as db_name then - s.append (db_name) - end - s.append (";LongNames=0;Timeout=1000;NoTXN=0;SyncPragma=NORMAL;StepAPI=0;") - create Result.make (create {DATABASE_CONNECTION_ODBC}.login_with_connection_string (s)) - --create Result.make (create {DATABASE_CONNECTION_ODBC}.login_with_connection_string (l_database_config.connection_string)) - end - end - - -end diff --git a/library/persistence/implementation/common/cms_storage_store_sql.e b/library/persistence/implementation/store/cms_storage_store_sql.e similarity index 89% rename from library/persistence/implementation/common/cms_storage_store_sql.e rename to library/persistence/implementation/store/cms_storage_store_sql.e index bd41408..57cee85 100644 --- a/library/persistence/implementation/common/cms_storage_store_sql.e +++ b/library/persistence/implementation/store/cms_storage_store_sql.e @@ -1,8 +1,8 @@ note description: "Summary description for {CMS_STORAGE_STORE_SQL}." author: "" - date: "$Date: 2015-01-27 19:15:02 +0100 (mar., 27 janv. 2015) $" - revision: "$Revision: 96542 $" + date: "$Date: 2015-02-13 13:08:13 +0100 (ven., 13 févr. 2015) $" + revision: "$Revision: 96616 $" deferred class CMS_STORAGE_STORE_SQL @@ -28,6 +28,14 @@ feature {NONE} -- Initialization -- error_handler.add_synchronization (db_handler.database_error_handler) end +feature -- Status report + + is_available: BOOLEAN + -- Is storage available? + do + Result := connection.is_connected + end + feature {NONE} -- Implementation db_handler: DATABASE_HANDLER @@ -66,6 +74,7 @@ feature -- Query check_sql_query_validity (a_sql_statement, a_params) db_handler.set_query (create {DATABASE_QUERY}.data_reader (a_sql_statement, a_params)) db_handler.execute_query + sql_post_execution end sql_change (a_sql_statement: STRING; a_params: detachable STRING_TABLE [detachable ANY]) @@ -73,6 +82,7 @@ feature -- Query check_sql_query_validity (a_sql_statement, a_params) db_handler.set_query (create {DATABASE_QUERY}.data_reader (a_sql_statement, a_params)) db_handler.execute_change + sql_post_execution end sql_rows_count: INTEGER diff --git a/library/persistence/implementation/common/database/database_config.e b/library/persistence/implementation/store/database/database_config.e similarity index 100% rename from library/persistence/implementation/common/database/database_config.e rename to library/persistence/implementation/store/database/database_config.e diff --git a/library/persistence/implementation/common/database/database_connection.e b/library/persistence/implementation/store/database/database_connection.e similarity index 100% rename from library/persistence/implementation/common/database/database_connection.e rename to library/persistence/implementation/store/database/database_connection.e diff --git a/library/persistence/implementation/common/database/database_connection_null.e b/library/persistence/implementation/store/database/database_connection_null.e similarity index 100% rename from library/persistence/implementation/common/database/database_connection_null.e rename to library/persistence/implementation/store/database/database_connection_null.e diff --git a/library/persistence/implementation/common/database/database_connection_odbc.e b/library/persistence/implementation/store/database/database_connection_odbc.e similarity index 100% rename from library/persistence/implementation/common/database/database_connection_odbc.e rename to library/persistence/implementation/store/database/database_connection_odbc.e diff --git a/library/persistence/implementation/common/database/database_handler.e b/library/persistence/implementation/store/database/database_handler.e similarity index 100% rename from library/persistence/implementation/common/database/database_handler.e rename to library/persistence/implementation/store/database/database_handler.e diff --git a/library/persistence/implementation/common/database/database_handler_impl.e b/library/persistence/implementation/store/database/database_handler_impl.e similarity index 100% rename from library/persistence/implementation/common/database/database_handler_impl.e rename to library/persistence/implementation/store/database/database_handler_impl.e diff --git a/library/persistence/implementation/common/database/database_iteration_cursor.e b/library/persistence/implementation/store/database/database_iteration_cursor.e similarity index 100% rename from library/persistence/implementation/common/database/database_iteration_cursor.e rename to library/persistence/implementation/store/database/database_iteration_cursor.e diff --git a/library/persistence/implementation/common/database/database_null.e b/library/persistence/implementation/store/database/database_null.e similarity index 100% rename from library/persistence/implementation/common/database/database_null.e rename to library/persistence/implementation/store/database/database_null.e diff --git a/library/persistence/implementation/common/database/database_query.e b/library/persistence/implementation/store/database/database_query.e similarity index 100% rename from library/persistence/implementation/common/database/database_query.e rename to library/persistence/implementation/store/database/database_query.e diff --git a/library/persistence/implementation/common/database/database_sql_server_encoder.e b/library/persistence/implementation/store/database/database_sql_server_encoder.e similarity index 100% rename from library/persistence/implementation/common/database/database_sql_server_encoder.e rename to library/persistence/implementation/store/database/database_sql_server_encoder.e diff --git a/library/persistence/implementation/common/database/database_store_procedure.e b/library/persistence/implementation/store/database/database_store_procedure.e similarity index 100% rename from library/persistence/implementation/common/database/database_store_procedure.e rename to library/persistence/implementation/store/database/database_store_procedure.e diff --git a/library/persistence/implementation/common/database/error/database_error.e b/library/persistence/implementation/store/database/error/database_error.e similarity index 100% rename from library/persistence/implementation/common/database/error/database_error.e rename to library/persistence/implementation/store/database/error/database_error.e diff --git a/library/persistence/implementation/common/database/error/database_error_handler.e b/library/persistence/implementation/store/database/error/database_error_handler.e similarity index 100% rename from library/persistence/implementation/common/database/error/database_error_handler.e rename to library/persistence/implementation/store/database/error/database_error_handler.e diff --git a/library/persistence/implementation/common/database/error/database_no_change_error.e b/library/persistence/implementation/store/database/error/database_no_change_error.e similarity index 100% rename from library/persistence/implementation/common/database/error/database_no_change_error.e rename to library/persistence/implementation/store/database/error/database_no_change_error.e diff --git a/library/persistence/implementation/common/database/parameter_name_helper.e b/library/persistence/implementation/store/database/parameter_name_helper.e similarity index 100% rename from library/persistence/implementation/common/database/parameter_name_helper.e rename to library/persistence/implementation/store/database/parameter_name_helper.e diff --git a/library/persistence/implementation/mysql/persistence_mysql-safe.ecf b/library/persistence/mysql/persistence_mysql-safe.ecf similarity index 87% rename from library/persistence/implementation/mysql/persistence_mysql-safe.ecf rename to library/persistence/mysql/persistence_mysql-safe.ecf index c60339d..43e48a5 100644 --- a/library/persistence/implementation/mysql/persistence_mysql-safe.ecf +++ b/library/persistence/mysql/persistence_mysql-safe.ecf @@ -7,19 +7,19 @@ - + - + - + - + /database/database_connection_odbc.e diff --git a/library/persistence/implementation/mysql/persistence_mysql.ecf b/library/persistence/mysql/persistence_mysql.ecf similarity index 87% rename from library/persistence/implementation/mysql/persistence_mysql.ecf rename to library/persistence/mysql/persistence_mysql.ecf index 99e8faf..a572b69 100644 --- a/library/persistence/implementation/mysql/persistence_mysql.ecf +++ b/library/persistence/mysql/persistence_mysql.ecf @@ -7,19 +7,19 @@ - + - + - + - + /database/database_connection_odbc.e diff --git a/library/persistence/implementation/mysql/scripts/Readme.md b/library/persistence/mysql/scripts/Readme.md similarity index 100% rename from library/persistence/implementation/mysql/scripts/Readme.md rename to library/persistence/mysql/scripts/Readme.md diff --git a/library/persistence/implementation/mysql/scripts/Readme.txt b/library/persistence/mysql/scripts/Readme.txt similarity index 100% rename from library/persistence/implementation/mysql/scripts/Readme.txt rename to library/persistence/mysql/scripts/Readme.txt diff --git a/library/persistence/implementation/mysql/scripts/create_database.sql b/library/persistence/mysql/scripts/create_database.sql similarity index 100% rename from library/persistence/implementation/mysql/scripts/create_database.sql rename to library/persistence/mysql/scripts/create_database.sql diff --git a/library/persistence/implementation/mysql/scripts/schema.sql b/library/persistence/mysql/scripts/schema.sql similarity index 100% rename from library/persistence/implementation/mysql/scripts/schema.sql rename to library/persistence/mysql/scripts/schema.sql diff --git a/library/persistence/implementation/mysql/scripts/tables.sql b/library/persistence/mysql/scripts/tables.sql similarity index 100% rename from library/persistence/implementation/mysql/scripts/tables.sql rename to library/persistence/mysql/scripts/tables.sql diff --git a/library/persistence/implementation/mysql/scripts/triggers.sql b/library/persistence/mysql/scripts/triggers.sql similarity index 100% rename from library/persistence/implementation/mysql/scripts/triggers.sql rename to library/persistence/mysql/scripts/triggers.sql diff --git a/library/persistence/implementation/mysql/src/cms_node_storage_mysql.e b/library/persistence/mysql/src/cms_node_storage_mysql.e similarity index 100% rename from library/persistence/implementation/mysql/src/cms_node_storage_mysql.e rename to library/persistence/mysql/src/cms_node_storage_mysql.e diff --git a/library/persistence/mysql/src/cms_storage_mysql.e b/library/persistence/mysql/src/cms_storage_mysql.e new file mode 100644 index 0000000..c30ad02 --- /dev/null +++ b/library/persistence/mysql/src/cms_storage_mysql.e @@ -0,0 +1,31 @@ +note + description: "Summary description for {CMS_STORAGE_MYSQL}." + date: "$Date: 2015-02-09 22:29:56 +0100 (lun., 09 févr. 2015) $" + revision: "$Revision: 96596 $" + +class + CMS_STORAGE_MYSQL + +inherit + CMS_STORAGE + + CMS_STORAGE_STORE_SQL + + CMS_USER_STORAGE_MYSQL + + CMS_NODE_STORAGE_MYSQL + + REFACTORING_HELPER + +create + make + +feature -- Status report + + is_initialized: BOOLEAN + -- Is storage initialized? + do + Result := has_user + end + +end diff --git a/library/persistence/implementation/mysql/src/cms_storage_mysql_builder.e b/library/persistence/mysql/src/cms_storage_mysql_builder.e similarity index 100% rename from library/persistence/implementation/mysql/src/cms_storage_mysql_builder.e rename to library/persistence/mysql/src/cms_storage_mysql_builder.e diff --git a/library/persistence/implementation/mysql/src/cms_user_storage_mysql.e b/library/persistence/mysql/src/cms_user_storage_mysql.e similarity index 100% rename from library/persistence/implementation/mysql/src/cms_user_storage_mysql.e rename to library/persistence/mysql/src/cms_user_storage_mysql.e diff --git a/library/persistence/implementation/mysql/src/database/database_connection_mysql.e b/library/persistence/mysql/src/database/database_connection_mysql.e similarity index 100% rename from library/persistence/implementation/mysql/src/database/database_connection_mysql.e rename to library/persistence/mysql/src/database/database_connection_mysql.e diff --git a/library/persistence/implementation/mysql/tests/application.e b/library/persistence/mysql/tests/application.e similarity index 100% rename from library/persistence/implementation/mysql/tests/application.e rename to library/persistence/mysql/tests/application.e diff --git a/library/persistence/implementation/mysql/tests/handler/database_handler_test.e b/library/persistence/mysql/tests/handler/database_handler_test.e similarity index 100% rename from library/persistence/implementation/mysql/tests/handler/database_handler_test.e rename to library/persistence/mysql/tests/handler/database_handler_test.e diff --git a/library/persistence/implementation/mysql/tests/nodes/node_test_set.e b/library/persistence/mysql/tests/nodes/node_test_set.e similarity index 100% rename from library/persistence/implementation/mysql/tests/nodes/node_test_set.e rename to library/persistence/mysql/tests/nodes/node_test_set.e diff --git a/library/persistence/mysql/tests/roles/role_test_set.e- b/library/persistence/mysql/tests/roles/role_test_set.e- new file mode 100644 index 0000000..bac254a --- /dev/null +++ b/library/persistence/mysql/tests/roles/role_test_set.e- @@ -0,0 +1,100 @@ +note + description: "Summary description for {ROLE_TEST_SET}." + author: "" + date: "$Date$" + revision: "$Revision$" + +class + ROLE_TEST_SET +inherit + EQA_TEST_SET + redefine + on_prepare, + on_clean + select + default_create + end + ABSTRACT_DB_TEST + rename + default_create as default_db_test + end + + +feature {NONE} -- Events + + on_prepare + -- + do + (create {CLEAN_DB}).clean_db(connection) + end + + on_clean + -- + do + end + +feature -- Test routines + + test_roles_empty + do + assert ("Not elements",role_provider.roles.after) + assert ("Count = 0", role_provider.count = 0) + end + + test_roles_by_id_not_exist + do + assert ("Void", role_provider.role (1) = Void) + end + + test_roles_by_name_not_exist + do + assert ("Void", role_provider.role_by_name ("admin") = Void) + end + + test_new_role + do + assert ("Count = 0", role_provider.count = 0) + role_provider.new_role ("admin") + assert ("Count = 1", role_provider.count = 1) + assert ("Expected role", attached role_provider.role (1) as l_role and then l_role.name ~ "admin") + assert ("Expected role", attached role_provider.role_by_name ("admin") as l_role and then l_role.id = 1) + end + + test_permissions_empty_not_exist_role + do + assert ("Not elements",role_provider.permission_by_role (1).after) + end + + test_permissions_empty_exist_role + do + assert ("Count = 0", role_provider.count = 0) + role_provider.new_role ("admin") + assert ("Count = 1", role_provider.count = 1) + assert ("Exist role",not role_provider.roles.after) + assert ("Not permission by role 1 elements",role_provider.permission_by_role (1).after) + end + + test_new_role_with_permissions + do + assert ("Count = 0", role_provider.count = 0) + role_provider.new_role ("admin") + role_provider.save_role_permission (1, "Create Page") + role_provider.save_role_permission (1, "Edit Page") + role_provider.save_role_permission (1, "Delete Page") + assert ("Count = 1", role_provider.count = 1) + assert ("Exist role",not role_provider.roles.after) + assert ("Exist role permissions",not role_provider.permission_by_role (1).after) + assert ("Not Exist role permissions, for id 2",role_provider.permission_by_role (2).after) + end + + + + +feature {NONE} -- Implementation + + role_provider: ROLE_DATA_PROVIDER + -- role provider. + once + create Result.make (connection) + end +end diff --git a/library/persistence/implementation/mysql/tests/storage/storage_test_set.e b/library/persistence/mysql/tests/storage/storage_test_set.e similarity index 100% rename from library/persistence/implementation/mysql/tests/storage/storage_test_set.e rename to library/persistence/mysql/tests/storage/storage_test_set.e diff --git a/library/persistence/implementation/mysql/tests/tests.ecf b/library/persistence/mysql/tests/tests.ecf similarity index 89% rename from library/persistence/implementation/mysql/tests/tests.ecf rename to library/persistence/mysql/tests/tests.ecf index efe3722..12ce203 100644 --- a/library/persistence/implementation/mysql/tests/tests.ecf +++ b/library/persistence/mysql/tests/tests.ecf @@ -7,9 +7,9 @@ - + - + diff --git a/library/persistence/implementation/mysql/tests/transactions/transaction_test_set.e b/library/persistence/mysql/tests/transactions/transaction_test_set.e similarity index 100% rename from library/persistence/implementation/mysql/tests/transactions/transaction_test_set.e rename to library/persistence/mysql/tests/transactions/transaction_test_set.e diff --git a/library/persistence/implementation/mysql/tests/users/user_test_set.e b/library/persistence/mysql/tests/users/user_test_set.e similarity index 100% rename from library/persistence/implementation/mysql/tests/users/user_test_set.e rename to library/persistence/mysql/tests/users/user_test_set.e diff --git a/library/persistence/implementation/mysql/tests/util/abstract_db_test.e b/library/persistence/mysql/tests/util/abstract_db_test.e similarity index 100% rename from library/persistence/implementation/mysql/tests/util/abstract_db_test.e rename to library/persistence/mysql/tests/util/abstract_db_test.e diff --git a/library/persistence/implementation/mysql/tests/util/clean_db.e b/library/persistence/mysql/tests/util/clean_db.e similarity index 100% rename from library/persistence/implementation/mysql/tests/util/clean_db.e rename to library/persistence/mysql/tests/util/clean_db.e diff --git a/library/persistence/implementation/sqlite/persistence_sqlite-safe.ecf b/library/persistence/sqlite/persistence_sqlite-safe.ecf similarity index 87% rename from library/persistence/implementation/sqlite/persistence_sqlite-safe.ecf rename to library/persistence/sqlite/persistence_sqlite-safe.ecf index abe11ca..8d3d9ec 100644 --- a/library/persistence/implementation/sqlite/persistence_sqlite-safe.ecf +++ b/library/persistence/sqlite/persistence_sqlite-safe.ecf @@ -7,19 +7,19 @@ - + - + - + - + /EIFGENs$ diff --git a/library/persistence/implementation/sqlite/persistence_sqlite.ecf b/library/persistence/sqlite/persistence_sqlite.ecf similarity index 87% rename from library/persistence/implementation/sqlite/persistence_sqlite.ecf rename to library/persistence/sqlite/persistence_sqlite.ecf index 15c6c61..365295e 100644 --- a/library/persistence/implementation/sqlite/persistence_sqlite.ecf +++ b/library/persistence/sqlite/persistence_sqlite.ecf @@ -7,19 +7,19 @@ - + - + - + - + /EIFGENs$ diff --git a/library/persistence/implementation/sqlite/scripts/Readme.txt b/library/persistence/sqlite/scripts/Readme.txt similarity index 100% rename from library/persistence/implementation/sqlite/scripts/Readme.txt rename to library/persistence/sqlite/scripts/Readme.txt diff --git a/library/persistence/implementation/sqlite/scripts/schema.sql b/library/persistence/sqlite/scripts/schema.sql similarity index 100% rename from library/persistence/implementation/sqlite/scripts/schema.sql rename to library/persistence/sqlite/scripts/schema.sql diff --git a/library/persistence/implementation/sqlite/src/cms_node_storage_sqlite.e b/library/persistence/sqlite/src/cms_node_storage_sqlite.e similarity index 92% rename from library/persistence/implementation/sqlite/src/cms_node_storage_sqlite.e rename to library/persistence/sqlite/src/cms_node_storage_sqlite.e index b8fe118..7f0dc80 100644 --- a/library/persistence/implementation/sqlite/src/cms_node_storage_sqlite.e +++ b/library/persistence/sqlite/src/cms_node_storage_sqlite.e @@ -1,8 +1,8 @@ note description: "Summary description for {CMS_NODE_STORAGE_SQLITE}." author: "" - date: "$Date: 2015-01-27 19:15:02 +0100 (mar., 27 janv. 2015) $" - revision: "$Revision: 96542 $" + date: "$Date: 2015-02-13 13:08:13 +0100 (ven., 13 févr. 2015) $" + revision: "$Revision: 96616 $" deferred class CMS_NODE_STORAGE_SQLITE @@ -50,7 +50,6 @@ feature -- Access: iterator log.write_information (generator + ".nodes_iterator") create l_parameters.make (0) sql_query (select_nodes, l_parameters) - sql_post_execution create Result.make (db_handler, agent fetch_node) end @@ -69,7 +68,6 @@ feature -- Access: iterator create l_query.make_from_string (select_recent_nodes) sql_query (l_query, l_parameters) create Result.make (db_handler, agent fetch_node) - sql_post_execution end end diff --git a/library/persistence/sqlite/src/cms_storage_sqlite.e b/library/persistence/sqlite/src/cms_storage_sqlite.e new file mode 100644 index 0000000..6444c7c --- /dev/null +++ b/library/persistence/sqlite/src/cms_storage_sqlite.e @@ -0,0 +1,31 @@ +note + description: "Summary description for {CMS_STORAGE_MYSQL}." + date: "$Date: 2015-02-09 22:29:56 +0100 (lun., 09 févr. 2015) $" + revision: "$Revision: 96596 $" + +class + CMS_STORAGE_SQLITE + +inherit + CMS_STORAGE + + CMS_STORAGE_STORE_SQL + + CMS_USER_STORAGE_SQLITE + + CMS_NODE_STORAGE_SQLITE + + REFACTORING_HELPER + +create + make + +feature -- Status report + + is_initialized: BOOLEAN + -- Is storage initialized? + do + Result := has_user + end + +end diff --git a/library/persistence/sqlite/src/cms_storage_sqlite_builder.e b/library/persistence/sqlite/src/cms_storage_sqlite_builder.e new file mode 100644 index 0000000..3feae38 --- /dev/null +++ b/library/persistence/sqlite/src/cms_storage_sqlite_builder.e @@ -0,0 +1,91 @@ +note + description: "[ + Objects that ... + ]" + author: "$Author: jfiat $" + date: "$Date: 2015-02-13 13:08:13 +0100 (ven., 13 févr. 2015) $" + revision: "$Revision: 96616 $" + +class + CMS_STORAGE_SQLITE_BUILDER + +inherit + CMS_STORAGE_BUILDER + +create + make + +feature {NONE} -- Initialization + + make + -- Initialize `Current'. + do + end + +feature -- Factory + + storage (a_setup: CMS_SETUP): detachable CMS_STORAGE_SQLITE + local + s: STRING + do + if attached (create {APPLICATION_JSON_CONFIGURATION_HELPER}).new_database_configuration (a_setup.layout.application_config_path) as l_database_config then + s := "Driver=SQLite3 ODBC Driver;Database=" + if attached l_database_config.database_name as db_name then + s.append (db_name) + end + s.append (";LongNames=0;Timeout=1000;NoTXN=0;SyncPragma=NORMAL;StepAPI=0;") + create Result.make (create {DATABASE_CONNECTION_ODBC}.login_with_connection_string (s)) + --create Result.make (create {DATABASE_CONNECTION_ODBC}.login_with_connection_string (l_database_config.connection_string)) + if Result.is_available then + if not Result.is_initialized then + initialize (a_setup, Result) + end + end + end + end + + initialize (a_setup: CMS_SETUP; a_storage: CMS_STORAGE_STORE_SQL) + do + initialize_schema (a_setup, a_storage) + initialize_data (a_setup, a_storage) + end + + initialize_schema (a_setup: CMS_SETUP; a_storage: CMS_STORAGE_STORE_SQL) + local + p: PATH + f: PLAIN_TEXT_FILE + sql: STRING + do + p := a_setup.layout.path.extended ("scripts").extended ("sqlite.sql") + create f.make_with_path (p) + if f.exists and then f.is_access_readable then + create sql.make (f.count) + f.open_read + from + f.start + until + f.exhausted or f.end_of_file + loop + f.read_stream_thread_aware (1_024) + sql.append (f.last_string) + end + f.close + a_storage.error_handler.reset +-- a_storage.sql_begin_transaction + a_storage.sql_change (sql, Void) +-- a_storage.sql_commit_transaction + end + end + + initialize_data (a_setup: CMS_SETUP; a_storage: CMS_STORAGE_STORE_SQL) + local + u: CMS_USER + do + create u.make ("admin") + u.set_password ("#admin#") + u.set_email (a_setup.site_email) + a_storage.new_user (u) + end + + +end diff --git a/library/persistence/implementation/sqlite/src/cms_user_storage_sqlite.e b/library/persistence/sqlite/src/cms_user_storage_sqlite.e similarity index 100% rename from library/persistence/implementation/sqlite/src/cms_user_storage_sqlite.e rename to library/persistence/sqlite/src/cms_user_storage_sqlite.e diff --git a/library/persistence/implementation/sqlite/tests/Readme.md b/library/persistence/sqlite/tests/Readme.md similarity index 100% rename from library/persistence/implementation/sqlite/tests/Readme.md rename to library/persistence/sqlite/tests/Readme.md diff --git a/library/persistence/implementation/sqlite/tests/application.e b/library/persistence/sqlite/tests/application.e similarity index 100% rename from library/persistence/implementation/sqlite/tests/application.e rename to library/persistence/sqlite/tests/application.e diff --git a/library/persistence/implementation/sqlite/tests/cms_lite.db b/library/persistence/sqlite/tests/cms_lite.db similarity index 92% rename from library/persistence/implementation/sqlite/tests/cms_lite.db rename to library/persistence/sqlite/tests/cms_lite.db index cad98d57c65c91c5eab1bed25255d9c8ad40c714..208c3a4ea00239f0563f5ea7751e0b9d0f3594fc 100644 GIT binary patch delta 1052 zcmZpez}PT>ae_2s*+dy<)=~!DXY3nOmN1JjuVVIKdc!n<$%OF+V-2GM!x4tmiH)B1 zv2Gj;#>U37ii$=ChNij(hPp)|2F6wfmc$8#WR~Ql#v2+0m*(as7F7aS&iQ#I zsd*(pR+KB)cxicg>}J&yVI{QiLku^C8Ey(Q+%(F81jF%} zZ2~d7zB1kfX1Ga|J(UbMhB@3AX0~yZ9agh}{wFn|8^H`Wf*EcUWeYN#fq@|mn3cq( zr7;5D!~}pSyg+lAm|rt6e`9{VS&-#Evlu56vp8d3eoAVw2L~gw tIA>{bYEd!oW=0)$4kqReKsC#lCvOlBVPjxnU|{|Mae_1>(?l6(Rwf4BXKWi&mN0MT5ctE)#>o7Qf%)5JL7q3vo4;}MaR3E2 hFfeb}EXc8pdGZGF5Fq~t1M?4{f_KcDe@Jua005mm7%>0< diff --git a/library/persistence/implementation/sqlite/tests/nodes/node_test_set.e b/library/persistence/sqlite/tests/nodes/node_test_set.e similarity index 100% rename from library/persistence/implementation/sqlite/tests/nodes/node_test_set.e rename to library/persistence/sqlite/tests/nodes/node_test_set.e diff --git a/library/persistence/implementation/sqlite/tests/storage/storage_test_set.e b/library/persistence/sqlite/tests/storage/storage_test_set.e similarity index 100% rename from library/persistence/implementation/sqlite/tests/storage/storage_test_set.e rename to library/persistence/sqlite/tests/storage/storage_test_set.e diff --git a/library/persistence/implementation/sqlite/tests/tests-safe.ecf b/library/persistence/sqlite/tests/tests-safe.ecf similarity index 89% rename from library/persistence/implementation/sqlite/tests/tests-safe.ecf rename to library/persistence/sqlite/tests/tests-safe.ecf index e06085e..65d472b 100644 --- a/library/persistence/implementation/sqlite/tests/tests-safe.ecf +++ b/library/persistence/sqlite/tests/tests-safe.ecf @@ -7,9 +7,9 @@ - + - + diff --git a/library/persistence/implementation/sqlite/tests/users/user_test_set.e b/library/persistence/sqlite/tests/users/user_test_set.e similarity index 100% rename from library/persistence/implementation/sqlite/tests/users/user_test_set.e rename to library/persistence/sqlite/tests/users/user_test_set.e diff --git a/library/persistence/implementation/sqlite/tests/util/abstract_db_test.e b/library/persistence/sqlite/tests/util/abstract_db_test.e similarity index 100% rename from library/persistence/implementation/sqlite/tests/util/abstract_db_test.e rename to library/persistence/sqlite/tests/util/abstract_db_test.e diff --git a/library/persistence/implementation/sqlite/tests/util/clean_db.e b/library/persistence/sqlite/tests/util/clean_db.e similarity index 100% rename from library/persistence/implementation/sqlite/tests/util/clean_db.e rename to library/persistence/sqlite/tests/util/clean_db.e diff --git a/src/configuration/cms_default_setup.e b/src/configuration/cms_default_setup.e index 9555a8b..7150fbf 100644 --- a/src/configuration/cms_default_setup.e +++ b/src/configuration/cms_default_setup.e @@ -2,8 +2,8 @@ note description: "[ Default CMS_SETUP that can be reused easily, and/or redefined to match specific setup. ]" - date: "$Date: 2015-01-27 19:15:02 +0100 (mar., 27 janv. 2015) $" - revision: "$Revision: 96542 $" + date: "$Date: 2015-02-13 13:08:13 +0100 (ven., 13 févr. 2015) $" + revision: "$Revision: 96616 $" class CMS_DEFAULT_SETUP @@ -86,7 +86,11 @@ feature {NONE} -- Initialization local m: CMS_MODULE do --- -- Core + -- Core +-- create {BASIC_AUTH_MODULE} m.make +-- m.enable +-- register_module (m) + -- create {USER_MODULE} m.make (Current) -- m.enable -- register_module (m) @@ -130,19 +134,6 @@ feature -- Access end end - is_html: BOOLEAN - -- - do - -- Enable change the mode - Result := (create {CMS_JSON_CONFIGURATION}).is_html_mode (layout.application_config_path) - end - - is_web: BOOLEAN - -- - do - Result := (create {CMS_JSON_CONFIGURATION}).is_web_mode (layout.application_config_path) - end - build_auth_engine do to_implement ("Not implemented authentication") diff --git a/src/configuration/cms_setup.e b/src/configuration/cms_setup.e index c18fc97..8a1d8e8 100644 --- a/src/configuration/cms_setup.e +++ b/src/configuration/cms_setup.e @@ -1,7 +1,7 @@ note description: "Class that enable to set basic configuration, application layout, core modules and themes." - date: "$Date: 2015-01-27 19:15:02 +0100 (mar., 27 janv. 2015) $" - revision: "$Revision: 96542 $" + date: "$Date: 2015-02-13 13:08:13 +0100 (ven., 13 févr. 2015) $" + revision: "$Revision: 96616 $" deferred class CMS_SETUP @@ -14,16 +14,6 @@ feature -- Access layout: CMS_LAYOUT -- CMS layout. - is_html: BOOLEAN - -- api with progressive enhancements css and js, server side rendering. - deferred - end - - is_web: BOOLEAN - -- web: Web Site with progressive enhancements css and js and Ajax calls. - deferred - end - enabled_modules: CMS_MODULE_COLLECTION -- List of enabled modules. local @@ -42,7 +32,7 @@ feature -- Access only_enabled_modules: across Result as ic all ic.item.is_enabled end end -feature {CMS_MODULE} -- Restricted access +feature {CMS_MODULE, CMS_API} -- Restricted access modules: CMS_MODULE_COLLECTION -- List of available modules. @@ -129,13 +119,10 @@ feature -- Access: storage attached storage_drivers.item (l_database_config.driver) as l_builder then Result := l_builder.storage (Current) - else - create {CMS_STORAGE_NULL} Result end else to_implement ("Workaround code, persistence layer does not implement yet this kind of error handling.") -- error hanling. - create {CMS_STORAGE_NULL} Result create l_message.make (1024) if attached ((create {EXCEPTION_MANAGER}).last_exception) as l_exception then if attached l_exception.description as l_description then @@ -161,11 +148,24 @@ feature -- Access: storage feature -- Element change + module_registered (m: CMS_MODULE): BOOLEAN + do + Result := modules.has (m) + end + + module_with_same_type_registered (m: CMS_MODULE): BOOLEAN + do + Result := modules.has_module_with_same_type (m) + end + register_module (m: CMS_MODULE) -- Add module `m' to `modules' + require + module_not_registered: not module_registered (m) + no_module_with_same_type_registered: not module_with_same_type_registered (m) deferred ensure - module_added: modules.has (m) + module_registered: module_registered (m) end end diff --git a/src/kernel/content/cms_block.e b/src/kernel/content/cms_block.e index 3782ab3..6ac240b 100644 --- a/src/kernel/content/cms_block.e +++ b/src/kernel/content/cms_block.e @@ -1,6 +1,6 @@ note description: "Describe content to be placed inside Regions." - date: "$Date: 2014-11-17 18:47:30 +0100 (lun., 17 nov. 2014) $" + date: "$Date: 2015-01-30 19:37:02 +0100 (ven., 30 janv. 2015) $" deferred class CMS_BLOCK diff --git a/src/kernel/content/cms_encoders.e b/src/kernel/content/cms_encoders.e index 348d70d..9459bbf 100644 --- a/src/kernel/content/cms_encoders.e +++ b/src/kernel/content/cms_encoders.e @@ -1,35 +1,38 @@ note description: "Summary description for {CMS_ENCODERS}." author: "" - date: "$Date: 2014-11-13 16:23:47 +0100 (jeu., 13 nov. 2014) $" - revision: "$Revision: 96085 $" + date: "$Date: 2015-02-13 13:08:13 +0100 (ven., 13 févr. 2015) $" + revision: "$Revision: 96616 $" class CMS_ENCODERS +inherit + ANY + + SHARED_HTML_ENCODER + export + {NONE} all + end + + SHARED_WSF_PERCENT_ENCODER + export + {NONE} all + end + feature -- Encoders - url_encoded (s: detachable READABLE_STRING_GENERAL): STRING_8 - local - enc: URL_ENCODER + html_encoded (a_string: READABLE_STRING_GENERAL): STRING_8 + -- `a_string' encoded for html output. do - create enc - if s /= Void then - Result := enc.general_encoded_string (s) - else - create Result.make_empty - end + Result := html_encoder.general_encoded_string (a_string) end - html_encoded (s: detachable READABLE_STRING_GENERAL): STRING_8 - local - enc: HTML_ENCODER + url_encoded, + percent_encoded (a_string: READABLE_STRING_GENERAL): STRING_8 + -- `a_string' encoded with percent encoding, mainly used for url. do - create enc - if s /= Void then - Result := enc.general_encoded_string (s) - else - create Result.make_empty - end + Result := percent_encoder.percent_encoded_string (a_string) end + end diff --git a/src/modules/basic_auth/basic_auth_module.e b/src/modules/basic_auth/basic_auth_module.e index c015ec0..33967cd 100644 --- a/src/modules/basic_auth/basic_auth_module.e +++ b/src/modules/basic_auth/basic_auth_module.e @@ -1,18 +1,24 @@ note description: "This module allows the use of HTTP Basic Authentication to restrict access by looking up users in the given providers." - date: "$Date: 2014-11-13 16:23:47 +0100 (jeu., 13 nov. 2014) $" - revision: "$Revision: 96085 $" + date: "$Date: 2015-02-09 22:29:56 +0100 (lun., 09 févr. 2015) $" + revision: "$Revision: 96596 $" class BASIC_AUTH_MODULE inherit - CMS_MODULE redefine - filters + filters, + register_hooks end + CMS_HOOK_AUTO_REGISTER + + CMS_HOOK_BLOCK + + CMS_HOOK_MENU_SYSTEM_ALTER + create make @@ -70,4 +76,46 @@ feature {NONE} -- Implementation: routes a_router.handle_with_request_methods ("/basic_auth_logoff", l_bal_handler, l_methods) end +feature -- Hooks configuration + + register_hooks (a_response: CMS_RESPONSE) + -- Module hooks configuration. + do +-- a_response.subscribe_to_block_hook (Current) + end + +feature -- Hooks + + block_list: ITERABLE [like {CMS_BLOCK}.name] + -- List of block names, managed by current object. + do + Result := <<"basic_auth_login_form">> + end + + get_block_view (a_block_id: READABLE_STRING_8; a_response: CMS_RESPONSE) + -- Get block object identified by `a_block_id' and associate with `a_response'. + do + if a_block_id.same_string ("basic_auth_login_form") then + + end + end + + menu_system_alter (a_menu_system: CMS_MENU_SYSTEM; a_response: CMS_RESPONSE) + -- Hook execution on collection of menu contained by `a_menu_system' + -- for related response `a_response'. + local + lnk: CMS_LOCAL_LINK + do + if attached a_response.current_user (a_response.request) as u then + create lnk.make ("Logout", "/basic_auth_logoff") + else + create lnk.make ("Login", "/basic_auth_login") + end +-- if not a_menu_system.primary_menu.has (lnk) then + lnk.set_weight (99) + a_menu_system.primary_menu.extend (lnk) +-- end + end + + end diff --git a/src/modules/basic_auth/filter/basic_auth_filter.e b/src/modules/basic_auth/filter/basic_auth_filter.e index e77073f..0659cb6 100644 --- a/src/modules/basic_auth/filter/basic_auth_filter.e +++ b/src/modules/basic_auth/filter/basic_auth_filter.e @@ -1,13 +1,12 @@ note description: "Processes a HTTP request's BASIC authorization headers, putting the result into the execution variable user." - date: "$Date: 2014-11-13 16:23:47 +0100 (jeu., 13 nov. 2014) $" - revision: "$Revision: 96085 $" + date: "$Date: 2015-02-13 13:08:13 +0100 (ven., 13 févr. 2015) $" + revision: "$Revision: 96616 $" class BASIC_AUTH_FILTER inherit - WSF_URI_TEMPLATE_HANDLER CMS_HANDLER WSF_FILTER @@ -22,22 +21,24 @@ feature -- Basic operations local l_auth: HTTP_AUTHORIZATION do - log.write_debug (generator + ".execute " ) + api.logger.put_debug (generator + ".execute ", Void) create l_auth.make (req.http_authorization) if attached req.raw_header_data as l_raw_data then - log.write_debug (generator + ".execute " + l_raw_data ) + api.logger.put_debug (generator + ".execute " + l_raw_data, Void) end -- A valid user - if (attached l_auth.type as l_auth_type and then l_auth_type.is_case_insensitive_equal_general ("basic")) and then - attached l_auth.login as l_auth_login and then attached l_auth.password as l_auth_password then - if api.is_valid_credential (l_auth_login, l_auth_password) then - if attached api.user_by_name (l_auth_login) as l_user then + if + (attached l_auth.type as l_auth_type and then l_auth_type.is_case_insensitive_equal_general ("basic")) and then + attached l_auth.login as l_auth_login and then attached l_auth.password as l_auth_password + then + if api.user_api.is_valid_credential (l_auth_login, l_auth_password) then + if attached api.user_api.user_by_name (l_auth_login) as l_user then debug ("refactor_fixme") fixme ("Maybe we need to store in the credentials in a shared context SECURITY_CONTEXT") -- req.set_execution_variable ("security_content", create SECURITY_CONTEXT.make (l_user)) -- other authentication filters (OpenID, etc) should implement the same approach. end - req.set_execution_variable ("user", l_user) + set_current_user (req, l_user) execute_next (req, res) else debug ("refactor_fixme") @@ -45,11 +46,11 @@ feature -- Basic operations end end else - log.write_error (generator + ".execute login_valid failed for: " + l_auth_login ) + api.logger.put_error (generator + ".execute login_valid failed for: " + l_auth_login, Void) execute_next (req, res) end else - log.write_error (generator + ".execute Not valid") + api.logger.put_error (generator + ".execute Not valid", Void) execute_next (req, res) end end diff --git a/src/modules/basic_auth/handler/basic_auth_login_handler.e b/src/modules/basic_auth/handler/basic_auth_login_handler.e index fd1ca36..fe738c2 100644 --- a/src/modules/basic_auth/handler/basic_auth_login_handler.e +++ b/src/modules/basic_auth/handler/basic_auth_login_handler.e @@ -1,7 +1,7 @@ note description: "Summary description for {BASIC_AUTH_LOGIN_HANDLER}." - date: "$Date: 2014-11-13 16:23:47 +0100 (jeu., 13 nov. 2014) $" - revision: "$Revision: 96085 $" + date: "$Date: 2015-02-13 13:08:13 +0100 (ven., 13 févr. 2015) $" + revision: "$Revision: 96616 $" class BASIC_AUTH_LOGIN_HANDLER @@ -48,7 +48,7 @@ feature -- HTTP Methods do_get (req: WSF_REQUEST; res: WSF_RESPONSE) -- do - log.write_information(generator + ".do_get Processing basic auth login") + api.logger.put_information (generator + ".do_get Processing basic auth login", Void) if attached {STRING_32} current_user_name (req) as l_user then (create {CMS_GENERIC_RESPONSE}).new_response_redirect (req, res, req.absolute_script_url("/")) else diff --git a/src/modules/basic_auth/handler/basic_auth_logoff_handler.e b/src/modules/basic_auth/handler/basic_auth_logoff_handler.e index 0a0f524..329a707 100644 --- a/src/modules/basic_auth/handler/basic_auth_logoff_handler.e +++ b/src/modules/basic_auth/handler/basic_auth_logoff_handler.e @@ -1,7 +1,7 @@ note description: "Summary description for {BASIC_AUTH_LOGOFF_HANDLER}." - date: "$Date: 2014-11-13 16:23:47 +0100 (jeu., 13 nov. 2014) $" - revision: "$Revision: 96085 $" + date: "$Date: 2015-02-13 13:08:13 +0100 (ven., 13 févr. 2015) $" + revision: "$Revision: 96616 $" class BASIC_AUTH_LOGOFF_HANDLER @@ -46,7 +46,7 @@ feature -- HTTP Methods local l_page: CMS_RESPONSE do - log.write_information(generator + ".do_get Processing basic auth logoff") + api.logger.put_information (generator + ".do_get Processing basic auth logoff", Void) if attached req.query_parameter ("prompt") as l_prompt then (create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res) else diff --git a/src/modules/cms_module_collection.e b/src/modules/cms_module_collection.e index 4533341..58ba768 100644 --- a/src/modules/cms_module_collection.e +++ b/src/modules/cms_module_collection.e @@ -1,8 +1,8 @@ note description: "Summary description for {CMS_MODULE_COLLECTION}." author: "" - date: "$Date: 2014-11-13 16:23:47 +0100 (jeu., 13 nov. 2014) $" - revision: "$Revision: 96085 $" + date: "$Date: 2015-02-09 22:29:56 +0100 (lun., 09 févr. 2015) $" + revision: "$Revision: 96596 $" class CMS_MODULE_COLLECTION @@ -36,6 +36,21 @@ feature -- Status report Result := modules.has (a_module) end + has_module_with_same_type (a_module: CMS_MODULE): BOOLEAN + -- Has module of type `a_type' already inserted? + local + l_type: TYPE [detachable CMS_MODULE] + do + l_type := a_module.generating_type + across + modules as ic + until + Result + loop + Result := ic.item = a_module or else ic.item.generating_type = l_type + end + end + count: INTEGER -- Number of modules. do @@ -47,7 +62,9 @@ feature -- Element change extend (a_module: CMS_MODULE) -- Add module do - modules.force (a_module) + if not has (a_module) then + modules.force (a_module) + end end remove (a_module: CMS_MODULE) diff --git a/src/modules/node/cms_node_api.e b/src/modules/node/cms_node_api.e new file mode 100644 index 0000000..6b13dc3 --- /dev/null +++ b/src/modules/node/cms_node_api.e @@ -0,0 +1,98 @@ +note + description: "Summary description for {CMS_NODE_API}." + author: "" + date: "$Date: 2015-02-13 13:08:13 +0100 (ven., 13 févr. 2015) $" + revision: "$Revision: 96616 $" + +class + CMS_NODE_API + +inherit + CMS_MODULE_API + + REFACTORING_HELPER + +create + make + +feature -- Access: Node + + nodes_count: INTEGER_64 + do + Result := storage.nodes_count + end + + nodes: LIST [CMS_NODE] + -- List of nodes. + do + Result := storage.nodes + end + + recent_nodes (a_offset, a_rows: INTEGER): LIST [CMS_NODE] + -- List of the `a_rows' most recent nodes starting from `a_offset'. + do + Result := storage.recent_nodes (a_offset, a_rows) + end + + node (a_id: INTEGER_64): detachable CMS_NODE + -- Node by ID. + do + debug ("refactor_fixme") + fixme ("Check preconditions") + end + Result := storage.node_by_id (a_id) + end + +feature -- Change: Node + + new_node (a_node: CMS_NODE) + -- Add a new node `a_node' + require + no_id: not a_node.has_id + do + storage.new_node (a_node) + end + + delete_node (a_node: CMS_NODE) + -- Delete `a_node'. + do + if a_node.has_id then + storage.delete_node (a_node) + end + end + + update_node (a_node: CMS_NODE) + -- Update node `a_node' data. + do + storage.update_node (a_node) + end + + update_node_title (a_user_id: like {CMS_USER}.id; a_node_id: like {CMS_NODE}.id; a_title: READABLE_STRING_32) + -- Update node title, with user identified by `a_id', with node id `a_node_id' and a new title `a_title'. + do + debug ("refactor_fixme") + fixme ("Check preconditions") + end + storage.update_node_title (a_user_id, a_node_id, a_title) + end + + update_node_summary (a_user_id: like {CMS_USER}.id; a_node_id: like {CMS_NODE}.id; a_summary: READABLE_STRING_32) + -- Update node summary, with user identified by `a_user_id', with node id `a_node_id' and a new summary `a_summary'. + do + debug ("refactor_fixme") + fixme ("Check preconditions") + end + storage.update_node_summary (a_user_id, a_node_id, a_summary) + end + + update_node_content (a_user_id: like {CMS_USER}.id; a_node_id: like {CMS_NODE}.id; a_content: READABLE_STRING_32) + -- Update node content, with user identified by `a_user_id', with node id `a_node_id' and a new content `a_content'. + do + debug ("refactor_fixme") + fixme ("Check preconditions") + end + storage.update_node_content (a_user_id, a_node_id, a_content) + end + + +end diff --git a/src/modules/node/handler/cms_node_handler.e b/src/modules/node/handler/cms_node_handler.e new file mode 100644 index 0000000..e426044 --- /dev/null +++ b/src/modules/node/handler/cms_node_handler.e @@ -0,0 +1,16 @@ +note + description: "Summary description for {CMS_NODE_HANDLER}." + author: "" + date: "$Date: 2015-02-13 13:08:13 +0100 (ven., 13 févr. 2015) $" + revision: "$Revision: 96616 $" + +deferred class + CMS_NODE_HANDLER + +inherit + CMS_MODULE_HANDLER [CMS_NODE_API] + rename + module_api as node_api + end + +end diff --git a/src/modules/node/handler/node_content_handler.e b/src/modules/node/handler/node_content_handler.e index 46bdbd5..47fd59b 100644 --- a/src/modules/node/handler/node_content_handler.e +++ b/src/modules/node/handler/node_content_handler.e @@ -1,16 +1,13 @@ note description: "Summary description for {NEW_CONTENT_HANDLER}." - date: "$Date: 2015-01-27 19:15:02 +0100 (mar., 27 janv. 2015) $" - revision: "$Revision: 96542 $" + date: "$Date: 2015-02-13 13:08:13 +0100 (ven., 13 févr. 2015) $" + revision: "$Revision: 96616 $" class NODE_CONTENT_HANDLER inherit - - CMS_HANDLER - - WSF_FILTER + CMS_NODE_HANDLER WSF_URI_HANDLER rename @@ -44,19 +41,18 @@ feature -- execute -- Execute request handler do execute_methods (req, res) - execute_next (req, res) end uri_execute (req: WSF_REQUEST; res: WSF_RESPONSE) -- Execute request handler do - execute_methods (req, res) + execute (req, res) end uri_template_execute (req: WSF_REQUEST; res: WSF_RESPONSE) -- Execute request handler do - execute_methods (req, res) + execute (req, res) end feature -- HTTP Methods @@ -69,7 +65,7 @@ feature -- HTTP Methods if attached current_user_name (req) then -- Existing node if attached {WSF_STRING} req.path_parameter ("id") as l_id then - if l_id.is_integer and then attached {CMS_NODE} api.node (l_id.integer_value) as l_node then + if l_id.is_integer and then attached node_api.node (l_id.integer_value) as l_node then create {GENERIC_VIEW_CMS_RESPONSE} l_page.make (req, res, api) l_page.add_variable (l_node.content, "node_content") l_page.add_variable (l_id.value, "id") @@ -91,7 +87,7 @@ feature -- HTTP Methods do if attached current_user_name (req) then if attached {WSF_STRING} req.path_parameter ("id") as l_id then - if l_id.is_integer and then attached {CMS_NODE} api.node (l_id.integer_value) as l_node then + if l_id.is_integer and then attached node_api.node (l_id.integer_value) as l_node then if attached {WSF_STRING} req.form_parameter ("method") as l_method then if l_method.is_case_insensitive_equal ("PUT") then do_put (req, res) @@ -118,10 +114,10 @@ feature -- HTTP Methods to_implement ("Check if user has permissions") if attached current_user (req) as l_user then if attached {WSF_STRING} req.path_parameter ("id") as l_id then - if l_id.is_integer and then attached {CMS_NODE} api.node (l_id.integer_value) as l_node then + if l_id.is_integer and then attached node_api.node (l_id.integer_value) as l_node then u_node := extract_data_form (req) u_node.set_id (l_id.value.to_integer_64) - api.update_node_content (l_user.id, u_node.id, u_node.content) + node_api.update_node_content (l_user.id, u_node.id, u_node.content) (create {CMS_GENERIC_RESPONSE}).new_response_redirect (req, res, req.absolute_script_url ("")) else do_error (req, res, l_id) diff --git a/src/modules/node/handler/node_handler.e b/src/modules/node/handler/node_handler.e index a6770ed..f55dd3c 100644 --- a/src/modules/node/handler/node_handler.e +++ b/src/modules/node/handler/node_handler.e @@ -1,15 +1,13 @@ note description: "Summary description for {NODE_HANDLER}." - date: "$Date: 2015-01-27 19:15:02 +0100 (mar., 27 janv. 2015) $" - revision: "$Revision: 96542 $" + date: "$Date: 2015-02-13 13:08:13 +0100 (ven., 13 févr. 2015) $" + revision: "$Revision: 96616 $" class NODE_HANDLER inherit - CMS_HANDLER - - WSF_FILTER + CMS_NODE_HANDLER WSF_URI_HANDLER rename @@ -44,19 +42,18 @@ feature -- execute -- Execute request handler do execute_methods (req, res) - execute_next (req, res) end uri_execute (req: WSF_REQUEST; res: WSF_RESPONSE) -- Execute request handler do - execute_methods (req, res) + execute (req, res) end uri_template_execute (req: WSF_REQUEST; res: WSF_RESPONSE) -- Execute request handler do - execute_methods (req, res) + execute (req, res) end feature -- HTTP Methods @@ -70,7 +67,7 @@ feature -- HTTP Methods if attached {WSF_STRING} req.path_parameter ("id") as l_id then if l_id.is_integer and then - attached api.node (l_id.value.to_integer_64) as l_node + attached node_api.node (l_id.value.to_integer_64) as l_node then create {GENERIC_VIEW_CMS_RESPONSE} l_page.make (req, res, api) l_page.add_variable (l_node, "node") @@ -94,7 +91,7 @@ feature -- HTTP Methods if attached {WSF_STRING} req.path_parameter ("id") as l_id then if l_id.is_integer and then - attached {CMS_NODE} api.node (l_id.value.to_integer_64) as l_node + attached node_api.node (l_id.value.to_integer_64) as l_node then if attached {WSF_STRING} req.form_parameter ("method") as l_method then if l_method.is_case_insensitive_equal ("DELETE") then @@ -113,7 +110,7 @@ feature -- HTTP Methods create u_node.make ("", "", "") update_node_from_data_form (req, u_node) u_node.set_author (l_user) - api.new_node (u_node) + node_api.new_node (u_node) (create {CMS_GENERIC_RESPONSE}).new_response_redirect (req, res, req.absolute_script_url ("")) end else @@ -129,11 +126,11 @@ feature -- HTTP Methods if attached {WSF_STRING} req.path_parameter ("id") as l_id then if l_id.is_integer and then - attached api.node (l_id.value.to_integer_64) as l_node + attached node_api.node (l_id.value.to_integer_64) as l_node then update_node_from_data_form (req, l_node) l_node.set_author (l_user) - api.update_node (l_node) + node_api.update_node (l_node) (create {CMS_GENERIC_RESPONSE}).new_response_redirect (req, res, req.absolute_script_url ("")) else do_error (req, res, l_id) @@ -153,9 +150,9 @@ feature -- HTTP Methods if attached {WSF_STRING} req.path_parameter ("id") as l_id then if l_id.is_integer and then - attached api.node (l_id.integer_value) as l_node + attached node_api.node (l_id.integer_value) as l_node then - api.delete_node (l_node) + node_api.delete_node (l_node) (create {CMS_GENERIC_RESPONSE}).new_response_redirect (req, res, req.absolute_script_url ("")) else do_error (req, res, l_id) @@ -197,10 +194,7 @@ feature {NONE} -- Node do if attached current_user_name (req) then create {GENERIC_VIEW_CMS_RESPONSE} l_page.make (req, res, api) - l_page.add_variable (setup.is_html, "html") - l_page.add_variable (setup.is_web, "web") l_page.execute - else (create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res) end diff --git a/src/modules/node/handler/node_summary_handler.e b/src/modules/node/handler/node_summary_handler.e index 8aea572..bf83150 100644 --- a/src/modules/node/handler/node_summary_handler.e +++ b/src/modules/node/handler/node_summary_handler.e @@ -1,15 +1,13 @@ note description: "Summary description for {NODE_SUMMARY_HANDLER}." - date: "$Date: 2015-01-27 19:15:02 +0100 (mar., 27 janv. 2015) $" - revision: "$Revision: 96542 $" + date: "$Date: 2015-02-13 13:08:13 +0100 (ven., 13 févr. 2015) $" + revision: "$Revision: 96616 $" class NODE_SUMMARY_HANDLER inherit - CMS_HANDLER - - WSF_FILTER + CMS_NODE_HANDLER WSF_URI_HANDLER rename @@ -43,19 +41,18 @@ feature -- execute -- Execute request handler do execute_methods (req, res) - execute_next (req, res) end uri_execute (req: WSF_REQUEST; res: WSF_RESPONSE) -- Execute request handler do - execute_methods (req, res) + execute (req, res) end uri_template_execute (req: WSF_REQUEST; res: WSF_RESPONSE) -- Execute request handler do - execute_methods (req, res) + execute (req, res) end feature -- HTTP Methods @@ -68,7 +65,7 @@ feature -- HTTP Methods if attached current_user_name (req) then -- Existing node if attached {WSF_STRING} req.path_parameter ("id") as l_id then - if l_id.is_integer and then attached {CMS_NODE} api.node (l_id.integer_value) as l_node then + if l_id.is_integer and then attached node_api.node (l_id.integer_value) as l_node then create {GENERIC_VIEW_CMS_RESPONSE} l_page.make (req, res, api) l_page.add_variable (l_id.value, "id") l_page.add_variable (l_node.summary, "node_summary") @@ -90,7 +87,7 @@ feature -- HTTP Methods do if attached current_user_name (req) then if attached {WSF_STRING} req.path_parameter ("id") as l_id then - if l_id.is_integer and then attached {CMS_NODE} api.node (l_id.integer_value) as l_node then + if l_id.is_integer and then attached node_api.node (l_id.integer_value) as l_node then if attached {WSF_STRING} req.form_parameter ("method") as l_method then if l_method.is_case_insensitive_equal ("PUT") then do_put (req, res) @@ -116,10 +113,10 @@ feature -- HTTP Methods do if attached current_user (req) as l_user then if attached {WSF_STRING} req.path_parameter ("id") as l_id then - if l_id.is_integer and then attached {CMS_NODE} api.node (l_id.integer_value) as l_node then + if l_id.is_integer and then attached node_api.node (l_id.integer_value) as l_node then u_node := extract_data_form (req) u_node.set_id (l_id.value.to_integer_64) - api.update_node_summary (l_user.id,u_node.id, u_node.summary) + node_api.update_node_summary (l_user.id,u_node.id, u_node.summary) (create {CMS_GENERIC_RESPONSE}).new_response_redirect (req, res, req.absolute_script_url ("")) else do_error (req, res, l_id) diff --git a/src/modules/node/handler/node_title_handler.e b/src/modules/node/handler/node_title_handler.e index 21cce14..63d0233 100644 --- a/src/modules/node/handler/node_title_handler.e +++ b/src/modules/node/handler/node_title_handler.e @@ -1,15 +1,13 @@ note description: "Summary description for {NODE_TITLE_HANDLER}." - date: "$Date: 2015-01-27 19:15:02 +0100 (mar., 27 janv. 2015) $" - revision: "$Revision: 96542 $" + date: "$Date: 2015-02-13 13:08:13 +0100 (ven., 13 févr. 2015) $" + revision: "$Revision: 96616 $" class NODE_TITLE_HANDLER inherit - CMS_HANDLER - - WSF_FILTER + CMS_NODE_HANDLER WSF_URI_HANDLER rename @@ -43,19 +41,18 @@ feature -- execute -- Execute request handler do execute_methods (req, res) - execute_next (req, res) end uri_execute (req: WSF_REQUEST; res: WSF_RESPONSE) -- Execute request handler do - execute_methods (req, res) + execute (req, res) end uri_template_execute (req: WSF_REQUEST; res: WSF_RESPONSE) -- Execute request handler do - execute_methods (req, res) + execute (req, res) end feature -- HTTP Methods @@ -68,7 +65,7 @@ feature -- HTTP Methods if attached current_user_name (req) as l_user then -- Existing node if attached {WSF_STRING} req.path_parameter ("id") as l_id then - if l_id.is_integer and then attached {CMS_NODE} api.node (l_id.integer_value) as l_node then + if l_id.is_integer and then attached node_api.node (l_id.integer_value) as l_node then create {GENERIC_VIEW_CMS_RESPONSE} l_page.make (req, res, api) l_page.add_variable (l_node.title, "node_title") l_page.add_variable (l_id.value, "id") @@ -89,7 +86,7 @@ feature -- HTTP Methods do if attached current_user_name (req) as l_user then if attached {WSF_STRING} req.path_parameter ("id") as l_id then - if l_id.is_integer and then attached {CMS_NODE} api.node (l_id.integer_value) as l_node then + if l_id.is_integer and then attached node_api.node (l_id.integer_value) as l_node then if attached {WSF_STRING} req.form_parameter ("method") as l_method then if l_method.is_case_insensitive_equal ("PUT") then do_put (req, res) @@ -116,10 +113,10 @@ feature -- HTTP Methods to_implement ("Check if user has permissions") if attached current_user (req) as l_user then if attached {WSF_STRING} req.path_parameter ("id") as l_id then - if l_id.is_integer and then attached {CMS_NODE} api.node (l_id.integer_value) as l_node then + if l_id.is_integer and then attached node_api.node (l_id.integer_value) as l_node then u_node := extract_data_form (req) u_node.set_id (l_id.value.to_integer_64) - api.update_node_title (l_user.id,u_node.id, u_node.title) + node_api.update_node_title (l_user.id, u_node.id, u_node.title) (create {CMS_GENERIC_RESPONSE}).new_response_redirect (req, res, req.absolute_script_url ("")) else do_error (req, res, l_id) diff --git a/src/modules/node/handler/nodes_handler.e b/src/modules/node/handler/nodes_handler.e index a5c4a48..36e1696 100644 --- a/src/modules/node/handler/nodes_handler.e +++ b/src/modules/node/handler/nodes_handler.e @@ -1,19 +1,16 @@ note description: "Summary description for {NODES_HANDLER}." - date: "$Date: 2014-11-13 16:23:47 +0100 (jeu., 13 nov. 2014) $" - revision: "$Revision: 96085 $" + date: "$Date: 2015-02-13 13:08:13 +0100 (ven., 13 févr. 2015) $" + revision: "$Revision: 96616 $" class NODES_HANDLER inherit - CMS_HANDLER - - WSF_FILTER + CMS_NODE_HANDLER WSF_URI_HANDLER rename - execute as uri_execute, new_mapping as new_uri_mapping end @@ -31,13 +28,6 @@ feature -- execute execute (req: WSF_REQUEST; res: WSF_RESPONSE) -- Execute request handler - do - execute_methods (req, res) - execute_next (req, res) - end - - uri_execute (req: WSF_REQUEST; res: WSF_RESPONSE) - -- Execute request handler do execute_methods (req, res) end @@ -53,7 +43,7 @@ feature -- HTTP Methods -- get them from the configuration file and load them into -- the setup class. create {GENERIC_VIEW_CMS_RESPONSE} l_page.make (req, res, api) - l_page.add_variable (api.nodes, "nodes") + l_page.add_variable (node_api.nodes, "nodes") l_page.execute end end diff --git a/src/modules/node/node_module.e b/src/modules/node/node_module.e index add17aa..91cdc52 100644 --- a/src/modules/node/node_module.e +++ b/src/modules/node/node_module.e @@ -1,7 +1,7 @@ note description: "CMS module that bring support for NODE management." - date: "$Date: 2015-01-27 19:15:02 +0100 (mar., 27 janv. 2015) $" - revision: "$Revision: 96542 $" + date: "$Date: 2015-02-13 13:08:13 +0100 (ven., 13 févr. 2015) $" + revision: "$Revision: 96616 $" class NODE_MODULE @@ -40,56 +40,59 @@ feature -- Access: router router (a_api: CMS_API): WSF_ROUTER -- Node router. + local + l_node_api: CMS_NODE_API do + create l_node_api.make (a_api) create Result.make (5) - configure_api_node (a_api, Result) - configure_api_nodes (a_api, Result) - configure_api_node_title (a_api, Result) - configure_api_node_summary (a_api, Result) - configure_api_node_content (a_api, Result) + configure_api_node (a_api, l_node_api, Result) + configure_api_nodes (a_api, l_node_api, Result) + configure_api_node_title (a_api, l_node_api, Result) + configure_api_node_summary (a_api, l_node_api, Result) + configure_api_node_content (a_api, l_node_api, Result) end feature {NONE} -- Implementation: routes - configure_api_node (api: CMS_API; a_router: WSF_ROUTER) + configure_api_node (a_api: CMS_API; a_node_api: CMS_NODE_API; a_router: WSF_ROUTER) local l_node_handler: NODE_HANDLER l_methods: WSF_REQUEST_METHODS do - create l_node_handler.make (api) + create l_node_handler.make (a_api, a_node_api) create l_methods l_methods.enable_get l_methods.enable_post l_methods.enable_put a_router.handle_with_request_methods ("/node", l_node_handler, l_methods) - create l_node_handler.make (api) + create l_node_handler.make (a_api, a_node_api) create l_methods l_methods.enable_get l_methods.enable_post l_methods.enable_put l_methods.enable_delete a_router.handle_with_request_methods ("/node/{id}", l_node_handler, l_methods) - a_router.handle_with_request_methods ("/nodes/", create {WSF_URI_AGENT_HANDLER}.make (agent do_get_nodes (?,?, api)), a_router.methods_get) + a_router.handle_with_request_methods ("/nodes/", create {WSF_URI_AGENT_HANDLER}.make (agent do_get_nodes (?,?, a_api, a_node_api)), a_router.methods_get) end - configure_api_nodes (api: CMS_API; a_router: WSF_ROUTER) + configure_api_nodes (a_api: CMS_API; a_node_api: CMS_NODE_API; a_router: WSF_ROUTER) local l_nodes_handler: NODES_HANDLER l_methods: WSF_REQUEST_METHODS do - create l_nodes_handler.make (api) + create l_nodes_handler.make (a_api, a_node_api) create l_methods l_methods.enable_get a_router.handle_with_request_methods ("/nodes", l_nodes_handler, l_methods) end - configure_api_node_summary (api: CMS_API; a_router: WSF_ROUTER) + configure_api_node_summary (a_api: CMS_API; a_node_api: CMS_NODE_API; a_router: WSF_ROUTER) local l_report_handler: NODE_SUMMARY_HANDLER l_methods: WSF_REQUEST_METHODS do - create l_report_handler.make (api) + create l_report_handler.make (a_api, a_node_api) create l_methods l_methods.enable_get l_methods.enable_post @@ -97,12 +100,12 @@ feature {NONE} -- Implementation: routes a_router.handle_with_request_methods ("/node/{id}/summary", l_report_handler, l_methods) end - configure_api_node_title (api: CMS_API; a_router: WSF_ROUTER) + configure_api_node_title (a_api: CMS_API; a_node_api: CMS_NODE_API; a_router: WSF_ROUTER) local l_report_handler: NODE_TITLE_HANDLER l_methods: WSF_REQUEST_METHODS do - create l_report_handler.make (api) + create l_report_handler.make (a_api, a_node_api) create l_methods l_methods.enable_get l_methods.enable_post @@ -110,12 +113,12 @@ feature {NONE} -- Implementation: routes a_router.handle_with_request_methods ("/node/{id}/title", l_report_handler, l_methods) end - configure_api_node_content (api: CMS_API; a_router: WSF_ROUTER) + configure_api_node_content (a_api: CMS_API; a_node_api: CMS_NODE_API; a_router: WSF_ROUTER) local l_report_handler: NODE_CONTENT_HANDLER l_methods: WSF_REQUEST_METHODS do - create l_report_handler.make (api) + create l_report_handler.make (a_api, a_node_api) create l_methods l_methods.enable_get l_methods.enable_post @@ -155,7 +158,7 @@ feature -- Hooks feature -- Handler - do_get_nodes (req: WSF_REQUEST; res: WSF_RESPONSE; a_api: CMS_API) + do_get_nodes (req: WSF_REQUEST; res: WSF_RESPONSE; a_api: CMS_API; a_node_api: CMS_NODE_API) local r: CMS_RESPONSE s: STRING @@ -164,22 +167,22 @@ feature -- Handler do create {GENERIC_VIEW_CMS_RESPONSE} r.make (req, res, a_api) - if attached a_api.user_by_name ("foo") as u then + if attached a_api.user_api.user_by_name ("foo") as u then l_user := u else create l_user.make ("foo") l_user.set_password ("foobar#") l_user.set_email ("test@example.com") - a_api.new_user (l_user) + a_api.user_api.new_user (l_user) end - if a_api.nodes_count = 0 then + if a_node_api.nodes_count = 0 then create l_node.make ({STRING_32} "This is a content", {STRING_32} "And a summary", {STRING_32} "Nice title") l_node.set_author (l_user) - a_api.new_node (l_node) + a_node_api.new_node (l_node) end create s.make_from_string ("

Nodes:

") - if attached a_api.nodes as lst then + if attached a_node_api.nodes as lst then across lst as ic loop diff --git a/src/persistence/cms_storage.e b/src/persistence/cms_storage.e index 3ce62fd..1a11b9a 100644 --- a/src/persistence/cms_storage.e +++ b/src/persistence/cms_storage.e @@ -3,8 +3,8 @@ note description : "[ CMS interface to storage ]" - date: "$Date: 2015-01-27 19:15:02 +0100 (mar., 27 janv. 2015) $" - revision: "$Revision: 96542 $" + date: "$Date: 2015-02-09 22:29:56 +0100 (lun., 09 févr. 2015) $" + revision: "$Revision: 96596 $" deferred class CMS_STORAGE @@ -22,6 +22,18 @@ feature {NONE} -- Initialization do end +feature -- Status report + + is_available: BOOLEAN + -- Is storage available? + deferred + end + + is_initialized: BOOLEAN + -- Is storage initialized? + deferred + end + feature -- Error Handling error_handler: ERROR_HANDLER diff --git a/src/persistence/cms_storage_null.e b/src/persistence/cms_storage_null.e index 0b85dd9..a9cfb95 100644 --- a/src/persistence/cms_storage_null.e +++ b/src/persistence/cms_storage_null.e @@ -1,7 +1,7 @@ note description: "Summary description for {CMS_STORAGE_NULL}." - date: "$Date: 2015-01-27 19:15:02 +0100 (mar., 27 janv. 2015) $" - revision: "$Revision: 96542 $" + date: "$Date: 2015-02-09 22:29:56 +0100 (lun., 09 févr. 2015) $" + revision: "$Revision: 96596 $" class CMS_STORAGE_NULL @@ -26,6 +26,20 @@ feature -- Initialization create error_handler.make end +feature -- Status report + + is_available: BOOLEAN + -- Is storage available? + do + Result := True + end + + is_initialized: BOOLEAN + -- Is storage initialized? + do + Result := True + end + feature -- Access: user has_user: BOOLEAN diff --git a/src/persistence/cms_storage_sql.e b/src/persistence/cms_storage_sql.e index 5b9bc13..5e1281e 100644 --- a/src/persistence/cms_storage_sql.e +++ b/src/persistence/cms_storage_sql.e @@ -1,8 +1,8 @@ note description: "Summary description for {CMS_STORAGE_SQL}." author: "" - date: "$Date: 2015-01-27 19:15:02 +0100 (mar., 27 janv. 2015) $" - revision: "$Revision: 96542 $" + date: "$Date: 2015-02-13 13:08:13 +0100 (ven., 13 févr. 2015) $" + revision: "$Revision: 96616 $" deferred class CMS_STORAGE_SQL @@ -10,9 +10,22 @@ deferred class feature -- Error handler error_handler: ERROR_HANDLER + -- Error handler. deferred end + has_error: BOOLEAN + -- Last operation reported error. + do + Result := error_handler.has_error + end + + reset_error + -- Reset errors. + do + error_handler.reset + end + feature -- Execution sql_begin_transaction @@ -29,6 +42,7 @@ feature -- Execution sql_post_execution -- Post database execution. + -- note: execute after each `sql_query' and `sql_change'. deferred end diff --git a/src/persistence/node/cms_node_storage_sql.e b/src/persistence/node/cms_node_storage_sql.e index 21c05cf..8d83ef5 100644 --- a/src/persistence/node/cms_node_storage_sql.e +++ b/src/persistence/node/cms_node_storage_sql.e @@ -1,8 +1,8 @@ note description: "Summary description for {CMS_NODE_STORAGE_SQL}." author: "" - date: "$Date: 2015-01-27 19:15:02 +0100 (mar., 27 janv. 2015) $" - revision: "$Revision: 96542 $" + date: "$Date: 2015-02-13 13:08:13 +0100 (ven., 13 févr. 2015) $" + revision: "$Revision: 96616 $" deferred class CMS_NODE_STORAGE_SQL @@ -27,7 +27,6 @@ feature -- Access if sql_rows_count = 1 then Result := sql_read_integer_64 (1) end - sql_post_execution end nodes: LIST [CMS_NODE] @@ -40,7 +39,6 @@ feature -- Access from sql_query (select_nodes, Void) - sql_post_execution sql_start until sql_after @@ -50,7 +48,6 @@ feature -- Access end sql_forth end - sql_post_execution end recent_nodes (a_lower: INTEGER; a_count: INTEGER): LIST [CMS_NODE] @@ -68,7 +65,6 @@ feature -- Access l_parameters.put (a_count, "rows") l_parameters.put (a_lower, "offset") sql_query (select_recent_nodes, l_parameters) - sql_post_execution sql_start until sql_after @@ -78,7 +74,6 @@ feature -- Access end sql_forth end - sql_post_execution end node_by_id (a_id: INTEGER_64): detachable CMS_NODE @@ -94,7 +89,6 @@ feature -- Access if sql_rows_count = 1 then Result := fetch_node end - sql_post_execution end node_author (a_id: like {CMS_NODE}.id): detachable CMS_USER @@ -110,7 +104,6 @@ feature -- Access if sql_rows_count >= 1 then Result := fetch_author end - sql_post_execution end last_inserted_node_id: INTEGER_64 @@ -122,7 +115,6 @@ feature -- Access if sql_rows_count = 1 then Result := sql_read_integer_64 (1) end - sql_post_execution end feature -- Change: Node @@ -151,10 +143,8 @@ feature -- Change: Node l_parameters.put (0, "author") end sql_change (sql_insert_node, l_parameters) - sql_post_execution if not error_handler.has_error then a_node.set_id (last_inserted_node_id) - sql_post_execution end end @@ -169,7 +159,6 @@ feature -- Change: Node create l_parameters.make (1) l_parameters.put (a_id, "id") sql_change (sql_delete_node, l_parameters) - sql_post_execution end update_node (a_node: CMS_NODE) @@ -194,7 +183,6 @@ feature -- Change: Node l_parameters.put (0, "author") end sql_change (sql_update_node, l_parameters) - sql_post_execution if not error_handler.has_error then a_node.set_modification_date (now) end @@ -213,7 +201,6 @@ feature -- Change: Node l_parameters.put (create {DATE_TIME}.make_now_utc, "changed") l_parameters.put (a_node_id, "nid") sql_change (sql_update_node_title, l_parameters) - sql_post_execution end update_node_summary (a_user_id: Like {CMS_USER}.id; a_node_id: like {CMS_NODE}.id; a_summary: READABLE_STRING_32) @@ -229,7 +216,6 @@ feature -- Change: Node l_parameters.put (create {DATE_TIME}.make_now_utc, "changed") l_parameters.put (a_node_id, "nid") sql_change (sql_update_node_summary, l_parameters) - sql_post_execution end update_node_content (a_user_id: Like {CMS_USER}.id;a_node_id: like {CMS_NODE}.id; a_content: READABLE_STRING_32) @@ -245,7 +231,6 @@ feature -- Change: Node l_parameters.put (create {DATE_TIME}.make_now_utc, "changed") l_parameters.put (a_node_id, "nid") sql_change (sql_update_node_content, l_parameters) - sql_post_execution end feature {NONE} -- Queries diff --git a/src/persistence/user/cms_user_storage_sql.e b/src/persistence/user/cms_user_storage_sql.e index efa0649..72e45f8 100644 --- a/src/persistence/user/cms_user_storage_sql.e +++ b/src/persistence/user/cms_user_storage_sql.e @@ -1,8 +1,8 @@ note description: "Summary description for {CMS_USER_STORAGE_SQL}." author: "" - date: "$Date: 2015-01-27 19:15:02 +0100 (mar., 27 janv. 2015) $" - revision: "$Revision: 96542 $" + date: "$Date: 2015-02-13 13:08:13 +0100 (ven., 13 févr. 2015) $" + revision: "$Revision: 96616 $" deferred class CMS_USER_STORAGE_SQL @@ -34,7 +34,6 @@ feature -- Access: user if sql_rows_count = 1 then Result := sql_read_integer_32 (1) end - sql_post_execution end users: LIST [CMS_USER] @@ -46,7 +45,6 @@ feature -- Access: user from sql_query (select_users, Void) - sql_post_execution sql_start until sql_after @@ -56,7 +54,6 @@ feature -- Access: user end sql_forth end - sql_post_execution end user_by_id (a_id: like {CMS_USER}.id): detachable CMS_USER @@ -74,7 +71,6 @@ feature -- Access: user else check no_more_than_one: sql_rows_count = 0 end end - sql_post_execution end user_by_name (a_name: like {CMS_USER}.name): detachable CMS_USER @@ -92,7 +88,6 @@ feature -- Access: user else check no_more_than_one: sql_rows_count = 0 end end - sql_post_execution end user_by_email (a_email: like {CMS_USER}.email): detachable CMS_USER @@ -110,7 +105,6 @@ feature -- Access: user else check no_more_than_one: sql_rows_count = 0 end end - sql_post_execution end is_valid_credential (l_auth_login, l_auth_password: READABLE_STRING_32): BOOLEAN @@ -163,10 +157,8 @@ feature -- Change: user l_parameters.put (create {DATE_TIME}.make_now_utc, "created") sql_change (sql_insert_user, l_parameters) - sql_post_execution if not error_handler.has_error then a_user.set_id (last_inserted_user_id) - sql_post_execution end sql_commit_transaction else @@ -207,7 +199,6 @@ feature -- Change: user l_parameters.put (create {DATE_TIME}.make_now_utc, "changed") sql_change (sql_update_user, l_parameters) - sql_post_execution else -- set error error_handler.add_custom_error (-1, "bad request" , "Missing password or email") @@ -251,7 +242,6 @@ feature {NONE} -- Implementation Result := l_salt end end - sql_post_execution end fetch_user: detachable CMS_USER @@ -297,7 +287,6 @@ feature {NONE} -- Implementation if sql_rows_count = 1 then Result := sql_read_integer_64 (1) end - sql_post_execution end feature {NONE} -- Sql Queries: USER diff --git a/src/service/cms_api.e b/src/service/cms_api.e index 392f12f..6b640aa 100644 --- a/src/service/cms_api.e +++ b/src/service/cms_api.e @@ -1,7 +1,7 @@ note description: "API for a CMS" - date: "$Date: 2015-01-27 19:15:02 +0100 (mar., 27 janv. 2015) $" - revision: "$Revision: 96542 $" + date: "$Date: 2015-02-13 13:08:13 +0100 (ven., 13 févr. 2015) $" + revision: "$Revision: 96616 $" class CMS_API @@ -11,35 +11,25 @@ inherit REFACTORING_HELPER - SHARED_HTML_ENCODER - export - {NONE} all - end - - SHARED_WSF_PERCENT_ENCODER - export - {NONE} all - end + CMS_ENCODERS create make -feature -- Initialize +feature {NONE} -- Initialize make (a_setup: CMS_SETUP) -- Create the API service with a setup `a_setup' do setup := a_setup create error_handler.make + create {CMS_ENV_LOGGER} logger.make initialize ensure setup_set: setup = a_setup error_handler_set: not error_handler.has_error end - setup: CMS_SETUP - -- CMS setup. - initialize -- Initialize the persitent layer. do @@ -51,7 +41,18 @@ feature -- Initialize end end -feature -- Access: Error +feature -- Access + + setup: CMS_SETUP + -- CMS setup. + + logger: CMS_LOGGER + -- Logger + + storage: CMS_STORAGE + -- Persistence storage. + +feature -- Status Report has_error: BOOLEAN -- Has error? @@ -59,162 +60,82 @@ feature -- Access: Error Result := error_handler.has_error end - as_string_representation: STRING_32 + string_representation_of_errors: STRING_32 -- String representation of all error(s). do Result := error_handler.as_string_representation end +feature -- Query: module + + module (a_type: TYPE [CMS_MODULE]): detachable CMS_MODULE + -- Enabled module typed `a_type', if any. + --| usage: if attached module ({FOO_MODULE}) as mod then ... + do + across + setup.modules as ic + until + Result /= Void + loop + Result := ic.item + if + not Result.is_enabled + or else Result.generating_type /~ a_type + then + Result := Void + end + end + end + + module_by_name (a_name: READABLE_STRING_GENERAL): detachable CMS_MODULE + -- Enabled module named `a_name', if any. + do + across + setup.modules as ic + until + Result /= Void + loop + Result := ic.item + if + not Result.is_enabled + or else not Result.name.is_case_insensitive_equal_general (a_name) + then + Result := Void + end + end + ensure + Result /= Void implies Result.name.is_case_insensitive_equal_general (a_name) + end + +feature -- Query: API + + user_api: CMS_USER_API + local + l_api: like internal_user_api + do + l_api := internal_user_api + if l_api = Void then + create l_api.make (Current) + internal_user_api := l_api + end + Result := l_api + end + feature -- Element Change: Error - reset + reset_error -- Reset error handler. do error_handler.reset end -feature {NONE}-- Error handler implemenations +feature {NONE}-- Implemenation error_handler: ERROR_HANDLER -- Error handler. -feature -- Status Report - - is_valid_credential (a_auth_login, a_auth_password: READABLE_STRING_32): BOOLEAN - -- Is the credentials `a_auth_login' and `a_auth_password' valid? - do - Result := storage.is_valid_credential (a_auth_login, a_auth_password) - end - -feature -- Access: Node - - nodes_count: INTEGER_64 - do - Result := storage.nodes_count - end - - nodes: LIST [CMS_NODE] - -- List of nodes. - do - Result := storage.nodes - end - - recent_nodes (a_offset, a_rows: INTEGER): LIST [CMS_NODE] - -- List of the `a_rows' most recent nodes starting from `a_offset'. - do - Result := storage.recent_nodes (a_offset, a_rows) - end - - node (a_id: INTEGER_64): detachable CMS_NODE - -- Node by ID. - do - debug ("refactor_fixme") - fixme ("Check preconditions") - end - Result := storage.node_by_id (a_id) - end - -feature -- Change: Node - - new_node (a_node: CMS_NODE) - -- Add a new node `a_node' - require - no_id: not a_node.has_id - do - storage.new_node (a_node) - end - - delete_node (a_node: CMS_NODE) - -- Delete `a_node'. - do - if a_node.has_id then - storage.delete_node (a_node) - end - end - - update_node (a_node: CMS_NODE) - -- Update node `a_node' data. - do - storage.update_node (a_node) - end - - update_node_title (a_user_id: like {CMS_USER}.id; a_node_id: like {CMS_NODE}.id; a_title: READABLE_STRING_32) - -- Update node title, with user identified by `a_id', with node id `a_node_id' and a new title `a_title'. - do - debug ("refactor_fixme") - fixme ("Check preconditions") - end - storage.update_node_title (a_user_id, a_node_id, a_title) - end - - update_node_summary (a_user_id: like {CMS_USER}.id; a_node_id: like {CMS_NODE}.id; a_summary: READABLE_STRING_32) - -- Update node summary, with user identified by `a_user_id', with node id `a_node_id' and a new summary `a_summary'. - do - debug ("refactor_fixme") - fixme ("Check preconditions") - end - storage.update_node_summary (a_user_id, a_node_id, a_summary) - end - - update_node_content (a_user_id: like {CMS_USER}.id; a_node_id: like {CMS_NODE}.id; a_content: READABLE_STRING_32) - -- Update node content, with user identified by `a_user_id', with node id `a_node_id' and a new content `a_content'. - do - debug ("refactor_fixme") - fixme ("Check preconditions") - end - storage.update_node_content (a_user_id, a_node_id, a_content) - end - - -feature -- Access: User - - user_by_name (a_username: READABLE_STRING_32): detachable CMS_USER - -- User by name `a_user_name', if any. - do - Result := storage.user_by_name (a_username) - end - -feature -- Change User - - new_user (a_user: CMS_USER) - -- Add a new user `a_user'. - require - no_id: not a_user.has_id - no_hashed_password: a_user.hashed_password = Void - do - if - attached a_user.password as l_password and then - attached a_user.email as l_email - then - storage.new_user (a_user) - else - debug ("refactor_fixme") - fixme ("Add error") - end - end - end - - update_user (a_user: CMS_USER) - -- Update user `a_user'. - require - has_id: a_user.has_id - do - storage.update_user (a_user) - end - -feature -- Helpers - - html_encoded (a_string: READABLE_STRING_GENERAL): STRING_8 - -- `a_string' encoded for html output. - do - Result := html_encoder.general_encoded_string (a_string) - end - - percent_encoded (a_string: READABLE_STRING_GENERAL): STRING_8 - -- `a_string' encoded with percent encoding, mainly used for url. - do - Result := percent_encoder.percent_encoded_string (a_string) - end + internal_user_api: detachable like user_api + -- Cached value for `user_api'. feature -- Layout @@ -249,10 +170,5 @@ feature -- Layout end end -feature {NONE} -- Implemenataion - - storage: CMS_STORAGE - -- Persistence storage. - end diff --git a/src/service/cms_module_api.e b/src/service/cms_module_api.e new file mode 100644 index 0000000..a5c085c --- /dev/null +++ b/src/service/cms_module_api.e @@ -0,0 +1,26 @@ +note + description: "Summary description for {CMS_MODULE_API}." + author: "" + date: "$Date: 2015-02-13 14:54:27 +0100 (ven., 13 févr. 2015) $" + revision: "$Revision: 96620 $" + +deferred class + CMS_MODULE_API + +feature {NONE} -- Implementation + + make (a_api: CMS_API) + do + api := a_api + end + +feature {CMS_MODULE, CMS_API} -- Restricted access + + api: CMS_API + + storage: CMS_STORAGE + do + Result := api.storage + end + +end diff --git a/src/service/cms_service.e b/src/service/cms_service.e index f3b91f6..2b8e06a 100644 --- a/src/service/cms_service.e +++ b/src/service/cms_service.e @@ -97,7 +97,7 @@ feature -- Settings: router l_api: like api l_router: like router do - log.write_debug (generator + ".setup_router") + api.logger.put_debug (generator + ".setup_router", Void) -- Configure root of api handler. l_router := router @@ -120,7 +120,7 @@ feature -- Settings: router l_root_handler: CMS_ROOT_HANDLER l_methods: WSF_REQUEST_METHODS do - log.write_debug (generator + ".configure_api_root") + api.logger.put_debug (generator + ".configure_api_root", Void) create l_root_handler.make (api) create l_methods l_methods.enable_get @@ -133,7 +133,7 @@ feature -- Settings: router local fhdl: WSF_FILE_SYSTEM_HANDLER do - log.write_debug (generator + ".configure_api_file_handler") + api.logger.put_information (generator + ".configure_api_file_handler", Void) create fhdl.make_hidden_with_path (setup.theme_assets_location) fhdl.disable_index @@ -172,7 +172,7 @@ feature -- Filters l_module: CMS_MODULE l_api: like api do - log.write_debug (generator + ".create_filter") + api.logger.put_debug (generator + ".create_filter", Void) l_filter := Void -- Maintenance @@ -211,7 +211,7 @@ feature -- Filters local f: WSF_FILTER do - log.write_debug (generator + ".setup_filter") + api.logger.put_debug (generator + ".setup_filter", Void) from f := filter diff --git a/src/service/filter/cms_error_filter.e b/src/service/filter/cms_error_filter.e index 297ba91..a07a3bc 100644 --- a/src/service/filter/cms_error_filter.e +++ b/src/service/filter/cms_error_filter.e @@ -1,7 +1,7 @@ note description: "Summary description for {CMS_ERROR_FILTER}." - date: "$Date: 2014-12-19 14:17:32 +0100 (ven., 19 déc. 2014) $" - revision: "$Revision: 96402 $" + date: "$Date: 2015-02-13 13:08:13 +0100 (ven., 13 févr. 2015) $" + revision: "$Revision: 96616 $" class CMS_ERROR_FILTER @@ -22,18 +22,18 @@ feature -- Basic operations do fixme ("Check if it's ok to add new fetures CMS_API.has_error:BOOLEAN and CMS_API.error_description.") if not api.has_error then - log.write_information (generator + ".execute with req: " + req.debug_output) + api.logger.put_information (generator + ".execute with req: " + req.debug_output, Void) if attached req.raw_header_data as l_header_data then - log.write_debug (generator + ".execute with req header: " + l_header_data) + api.logger.put_debug (generator + ".execute with req header: " + l_header_data, Void) end if attached req.raw_input_data as l_input_data then - log.write_debug (generator + ".execute with req input: " + l_input_data) + api.logger.put_debug (generator + ".execute with req input: " + l_input_data, Void) end execute_next (req, res) else - log.write_critical (generator + ".execute" + api.as_string_representation ) + api.logger.put_critical (generator + ".execute" + api.string_representation_of_errors, Void) (create {INTERNAL_SERVER_ERROR_CMS_RESPONSE}.make (req, res, api)).execute - api.reset + api.reset_error end end diff --git a/src/service/handler/cms_handler.e b/src/service/handler/cms_handler.e index 366d853..03869bf 100644 --- a/src/service/handler/cms_handler.e +++ b/src/service/handler/cms_handler.e @@ -1,36 +1,27 @@ note description: "Summary description for {CMS_HANDLER}." author: "" - date: "$Date: 2014-11-13 16:23:47 +0100 (jeu., 13 nov. 2014) $" - revision: "$Revision: 96085 $" + date: "$Date: 2015-02-13 13:08:13 +0100 (ven., 13 févr. 2015) $" + revision: "$Revision: 96616 $" deferred class CMS_HANDLER inherit - WSF_HANDLER CMS_REQUEST_UTIL - SHARED_LOGGER - REFACTORING_HELPER feature {NONE} -- Initialization make (a_api: CMS_API) + -- Initialize Current handler with `a_api'. do api := a_api end -feature -- Setup - - setup: CMS_SETUP - do - Result := api.setup - end - feature -- API Service api: CMS_API diff --git a/src/service/handler/cms_module_handler.e b/src/service/handler/cms_module_handler.e new file mode 100644 index 0000000..4a86272 --- /dev/null +++ b/src/service/handler/cms_module_handler.e @@ -0,0 +1,27 @@ +note + description: "Summary description for {CMS_MODULE_HANDLER}." + author: "" + date: "$Date: 2015-02-13 13:08:13 +0100 (ven., 13 févr. 2015) $" + revision: "$Revision: 96616 $" + +deferred class + CMS_MODULE_HANDLER [G -> CMS_MODULE_API] + +inherit + CMS_HANDLER + rename + make as cms_make + end + +feature {NONE} -- Initialization + + make (a_api: CMS_API; a_module_api: G) + do + cms_make (a_api) + module_api := a_module_api + end + + module_api: G + -- Node api + +end diff --git a/src/service/handler/cms_root_handler.e b/src/service/handler/cms_root_handler.e index 1364e1c..89d3773 100644 --- a/src/service/handler/cms_root_handler.e +++ b/src/service/handler/cms_root_handler.e @@ -1,20 +1,16 @@ note description: "Summary description for {CMS_ROOT_HANDLER}." - date: "$Date: 2014-11-13 16:23:47 +0100 (jeu., 13 nov. 2014) $" - revision: "$Revision: 96085 $" + date: "$Date: 2015-02-13 13:08:13 +0100 (ven., 13 févr. 2015) $" + revision: "$Revision: 96616 $" class CMS_ROOT_HANDLER inherit - CMS_HANDLER - WSF_FILTER - WSF_URI_HANDLER rename - execute as uri_execute, new_mapping as new_uri_mapping end @@ -32,13 +28,6 @@ feature -- execute execute (req: WSF_REQUEST; res: WSF_RESPONSE) -- Execute request handler - do - execute_methods (req, res) - execute_next (req, res) - end - - uri_execute (req: WSF_REQUEST; res: WSF_RESPONSE) - -- Execute request handler do execute_methods (req, res) end diff --git a/src/service/logger/cms_env_logger.e b/src/service/logger/cms_env_logger.e new file mode 100644 index 0000000..ebb4c58 --- /dev/null +++ b/src/service/logger/cms_env_logger.e @@ -0,0 +1,60 @@ +note + description : "Objects that ..." + author : "$Author: jfiat $" + date : "$Date: 2015-02-13 13:08:13 +0100 (ven., 13 févr. 2015) $" + revision : "$Revision: 96616 $" + +class + CMS_ENV_LOGGER + +inherit + CMS_LOGGER + + SHARED_LOGGER + rename + log as log_facility + end + +create + make + +feature {NONE} -- Initialization + + make + -- Initialize `Current'. + do + end + +feature -- Logging + + put_information (a_message: READABLE_STRING_8; a_data: detachable ANY) + do + log_facility.write_information (log_message (a_message, a_data)) + end + + put_error (a_message: READABLE_STRING_8; a_data: detachable ANY) + do + log_facility.write_error (log_message (a_message, a_data)) + end + + put_warning (a_message: READABLE_STRING_8; a_data: detachable ANY) + do + log_facility.write_warning (log_message (a_message, a_data)) + end + + put_critical (a_message: READABLE_STRING_8; a_data: detachable ANY) + do + log_facility.write_critical (log_message (a_message, a_data)) + end + + put_alert (a_message: READABLE_STRING_8; a_data: detachable ANY) + do + log_facility.write_alert (log_message (a_message, a_data)) + end + + put_debug (a_message: READABLE_STRING_8; a_data: detachable ANY) + do + log_facility.write_debug (log_message (a_message, a_data)) + end + +end diff --git a/src/service/logger/cms_logger.e b/src/service/logger/cms_logger.e new file mode 100644 index 0000000..08afe3a --- /dev/null +++ b/src/service/logger/cms_logger.e @@ -0,0 +1,55 @@ +note + description : "Objects that ..." + author : "$Author: jfiat $" + date : "$Date: 2015-02-13 13:08:13 +0100 (ven., 13 févr. 2015) $" + revision : "$Revision: 96616 $" + +deferred class + CMS_LOGGER + +feature -- Logging + + put_information (a_message: READABLE_STRING_8; a_data: detachable ANY) + deferred + end + + put_error (a_message: READABLE_STRING_8; a_data: detachable ANY) + deferred + end + + put_warning (a_message: READABLE_STRING_8; a_data: detachable ANY) + deferred + end + + put_critical (a_message: READABLE_STRING_8; a_data: detachable ANY) + deferred + end + + put_alert (a_message: READABLE_STRING_8; a_data: detachable ANY) + deferred + end + + put_debug (a_message: READABLE_STRING_8; a_data: detachable ANY) + deferred + end + +feature {NONE} -- Logging + + log_message (a_message: READABLE_STRING_8; a_data: detachable ANY): STRING + do + create Result.make (a_message.count) + if attached {CMS_MODULE} a_data as a_module then + Result.append_character ('[') + Result.append (a_module.name) + Result.append_character (']') + Result.append_character (' ') + elseif attached {TYPE [detachable ANY]} a_data as a_type then + Result.append_character ('{') + Result.append (a_type.out) + Result.append_character ('}') + Result.append_character (' ') + end + Result.append (a_message) + end + +end diff --git a/src/service/logger/cms_null_logger.e b/src/service/logger/cms_null_logger.e new file mode 100644 index 0000000..6763c6d --- /dev/null +++ b/src/service/logger/cms_null_logger.e @@ -0,0 +1,39 @@ +note + description : "Objects that ..." + author : "$Author: jfiat $" + date : "$Date: 2015-02-13 13:08:13 +0100 (ven., 13 févr. 2015) $" + revision : "$Revision: 96616 $" + +class + CMS_NULL_LOGGER + +inherit + CMS_LOGGER + +feature -- Logging + + put_information (a_message: READABLE_STRING_8; a_data: detachable ANY) + do + end + + put_error (a_message: READABLE_STRING_8; a_data: detachable ANY) + do + end + + put_warning (a_message: READABLE_STRING_8; a_data: detachable ANY) + do + end + + put_critical (a_message: READABLE_STRING_8; a_data: detachable ANY) + do + end + + put_alert (a_message: READABLE_STRING_8; a_data: detachable ANY) + do + end + + put_debug (a_message: READABLE_STRING_8; a_data: detachable ANY) + do + end + +end diff --git a/src/service/cms_request_util.e b/src/service/misc/cms_request_util.e similarity index 69% rename from src/service/cms_request_util.e rename to src/service/misc/cms_request_util.e index eefc49b..90df0b2 100644 --- a/src/service/cms_request_util.e +++ b/src/service/misc/cms_request_util.e @@ -1,14 +1,13 @@ note description: "Summary description for {CMS_REQUEST_UTIL}." author: "" - date: "$Date: 2014-11-13 16:23:47 +0100 (jeu., 13 nov. 2014) $" - revision: "$Revision: 96085 $" + date: "$Date: 2015-02-13 13:08:13 +0100 (ven., 13 févr. 2015) $" + revision: "$Revision: 96616 $" deferred class CMS_REQUEST_UTIL inherit - CMS_ENCODERS REFACTORING_HELPER @@ -30,11 +29,25 @@ feature -- User note EIS: "eiffel:?class=AUTHENTICATION_FILTER&feature=execute" do - if attached {CMS_USER} req.execution_variable ("user") as l_user then + if attached {CMS_USER} req.execution_variable ("_cms_active_user_") as l_user then Result := l_user end end +feature -- Change + + set_current_user (req: WSF_REQUEST; a_user: detachable CMS_USER) + -- Set `a_user' as `current_user'. + do + if a_user = Void then + req.unset_execution_variable ("_cms_active_user_") + else + req.set_execution_variable ("_cms_active_user_", a_user) + end + ensure + user_set: current_user (req) ~ a_user + end + feature -- Media Type current_media_type (req: WSF_REQUEST): detachable READABLE_STRING_32 diff --git a/src/service/cms_url_utilities.e b/src/service/misc/cms_url_utilities.e similarity index 96% rename from src/service/cms_url_utilities.e rename to src/service/misc/cms_url_utilities.e index 378bbde..d6d30ed 100644 --- a/src/service/cms_url_utilities.e +++ b/src/service/misc/cms_url_utilities.e @@ -1,8 +1,8 @@ note description: "Summary description for {CMS_URL_UTILITIES}." author: "" - date: "$Date: 2014-11-13 16:23:47 +0100 (jeu., 13 nov. 2014) $" - revision: "$Revision: 96085 $" + date: "$Date: 2015-02-13 13:08:13 +0100 (ven., 13 févr. 2015) $" + revision: "$Revision: 96616 $" deferred class CMS_URL_UTILITIES diff --git a/src/service/response/cms_response.e b/src/service/response/cms_response.e index 4bd77ee..656c89c 100644 --- a/src/service/response/cms_response.e +++ b/src/service/response/cms_response.e @@ -1,7 +1,7 @@ note description: "Generic CMS Response.It builds the content to get process to render the output" - date: "$Date: 2014-12-15 21:43:38 +0100 (lun., 15 déc. 2014) $" - revision: "$Revision: 96346 $" + date: "$Date: 2015-02-13 13:08:13 +0100 (ven., 13 févr. 2015) $" + revision: "$Revision: 96616 $" deferred class CMS_RESPONSE @@ -357,7 +357,6 @@ feature -- Blocks regions end end - feature -- Blocks add_block (b: CMS_BLOCK; a_default_region: detachable READABLE_STRING_8) @@ -369,7 +368,6 @@ feature -- Blocks l_region.extend (b) end - get_blocks do debug ("refactor_fixme") @@ -754,9 +752,13 @@ feature -- Element Change feature -- Generation prepare (page: CMS_HTML_PAGE) + local + lnk: CMS_LINK do -- Menu - add_to_primary_menu (create {CMS_LOCAL_LINK}.make ("Home", "/")) + create {CMS_LOCAL_LINK} lnk.make ("Home", "/") + lnk.set_weight (-10) + add_to_primary_menu (lnk) invoke_menu_system_alter (menu_system) prepare_menu_system (menu_system) @@ -774,6 +776,11 @@ feature -- Generation end end + -- Sort items + across menu_system as ic loop + ic.item.sort + end + -- Values common_prepare (page) custom_prepare (page) @@ -843,10 +850,6 @@ feature -- Generation page.register_variable (title, "site_title") page.set_is_front (is_front) - -- Variables/Setup - page.register_variable (setup.is_web, "web") - page.register_variable (setup.is_html, "html") - -- Variables/Misc -- FIXME: logo .. could be a settings of theme, managed by admin front-end/database. diff --git a/src/service/user/cms_user_api.e b/src/service/user/cms_user_api.e new file mode 100644 index 0000000..5d89cea --- /dev/null +++ b/src/service/user/cms_user_api.e @@ -0,0 +1,62 @@ +note + description: "Summary description for {CMS_USER_API}." + author: "" + date: "$Date: 2015-02-13 13:08:13 +0100 (ven., 13 févr. 2015) $" + revision: "$Revision: 96616 $" + +class + CMS_USER_API + +inherit + CMS_MODULE_API + + REFACTORING_HELPER + +create + make + +feature -- Access + + user_by_name (a_username: READABLE_STRING_32): detachable CMS_USER + -- User by name `a_user_name', if any. + do + Result := storage.user_by_name (a_username) + end + +feature -- Status report + + is_valid_credential (a_auth_login, a_auth_password: READABLE_STRING_32): BOOLEAN + -- Is the credentials `a_auth_login' and `a_auth_password' valid? + do + Result := storage.is_valid_credential (a_auth_login, a_auth_password) + end + +feature -- Change User + + new_user (a_user: CMS_USER) + -- Add a new user `a_user'. + require + no_id: not a_user.has_id + no_hashed_password: a_user.hashed_password = Void + do + if + attached a_user.password as l_password and then + attached a_user.email as l_email + then + storage.new_user (a_user) + else + debug ("refactor_fixme") + fixme ("Add error") + end + end + end + + update_user (a_user: CMS_USER) + -- Update user `a_user'. + require + has_id: a_user.has_id + do + storage.update_user (a_user) + end + +end diff --git a/src/theme/cms_theme.e b/src/theme/cms_theme.e index e5036b4..74eca9e 100644 --- a/src/theme/cms_theme.e +++ b/src/theme/cms_theme.e @@ -1,7 +1,7 @@ note description: "Abstract class describing a generic theme" - date: "$Date: 2014-11-18 02:49:56 +0100 (mar., 18 nov. 2014) $" - revision: "$Revision: 96108 $" + date: "$Date: 2015-02-16 12:52:35 +0100 (lun., 16 févr. 2015) $" + revision: "$Revision: 96630 $" deferred class CMS_THEME @@ -69,7 +69,7 @@ feature -- Conversion end s.append (a_block.to_html (Current)) else - create s.make_from_string ("
") + create s.make_from_string ("
") if attached a_block.title as l_title then s.append ("
" + html_encoded (l_title) + "
") end diff --git a/src/theme/smarty_theme/smarty_cms_theme.e b/src/theme/smarty_theme/smarty_cms_theme.e index 0632dd4..5f408e4 100644 --- a/src/theme/smarty_theme/smarty_cms_theme.e +++ b/src/theme/smarty_theme/smarty_cms_theme.e @@ -1,7 +1,7 @@ note description: "Smarty template CMS theme." - date: "$Date: 2014-12-05 22:39:27 +0100 (ven., 05 déc. 2014) $" - revision: "$Revision: 96260 $" + date: "$Date: 2015-02-09 22:29:56 +0100 (lun., 09 févr. 2015) $" + revision: "$Revision: 96596 $" class SMARTY_CMS_THEME @@ -56,7 +56,7 @@ feature -- Access else l_regions := <<"top","header", "highlighted","help", "content", "footer", "first_sidebar", "second_sidebar", "bottom">> end - internaL_regions := l_regions + internal_regions := l_regions end Result := l_regions end