Compare commits

...

446 Commits

Author SHA1 Message Date
3496536751 Added CMS_API.request: WSF_REQUEST to ease dev of ROC CMS code.
- Removed CMS_REQUEST_UTIL
  - centralize a few request related code into CMS_API
Added CMS_API.user, CMS_API.set_user (CMS_USER), ... and user related routines.

Refactored Auth related code
  - added various abstractions to factorize implementation and harmonize solutions.
  - revisited the logout strategy.
  - updated the account info page, and remove info user should not care about.
  - simplified the process, and encourage auth module to follow same design.

Added CMS_LINK helper routines to modify the related query string.
Removed CMS_USER.profile (and related routines)
   - It was not used so far.
   - it will probably a specific module later, if needed.

Update various module to avoid fetching user from sql directly, and let this task to CMS_USER_API.

Removed CMS_NODE_API.node_author (a_node: CMS_NODE): detachable CMS_USER,
   - as the info is already in CMS_NODE.author

Added CMS_RESPONSE.redirection_delay, if ever one code want to redirect after a few seconds.
Added the request uri info to the not found cms response.
2016-01-29 21:58:49 +01:00
41ac45d07b Fixed various CMS_MODULE.install, by not marked module installed if an error occurred!
Improved Auth related module implementation by having a way to change settings like token, max age.
  - use CMS_SETUP.site_id and related "auth.$module.token" ... configuration values.
  - removed related CMS_..._CONSTANTS classes.

For auth session module, use auth_session as table name, and use VARCHAR(64).
Extracted sql from blog module, and store it under site/scripts/install.sql .
Renamed a few $modulename.sql as install.sql
2016-01-27 18:22:20 +01:00
d3b485f4d3 Removed unused local variable. 2016-01-22 22:19:24 +01:00
2b1d5f9693 Updated to new routine type. 2016-01-22 21:41:56 +01:00
59c03c5f4d Added CMS_STRING_EXPANDER.
For now with basic implementation.
  It will be improved later

Added SEO related attribute in CMS_RESPONSE.
Added improved Contact module.
Added basic SEO module.
2016-01-22 21:33:06 +01:00
39ab19d20e Eiffel code and ECFs update to support new agent notations.
Accepts /account and /account/ .
2016-01-19 16:15:13 +01:00
fd5e396b72 Code cleaning. 2016-01-15 18:35:53 +01:00
5bd28326c2 Added source for sql scripts. 2016-01-15 17:59:21 +01:00
eef2a52f48 Integrated new registration workflow.
Added optional "mailer.subject_prefix" configuration item.
Added CMS_SETUP.utf_8_site_name for convenience.
Fixed a few potential unicode issues.
Fixed various typos.
2016-01-15 17:46:56 +01:00
a6642e9f3e Fixed location of library "http_client_extension" in recaptcha library. 2016-01-15 14:11:51 +01:00
affe3beb27 Merge branch 'roc_register' of https://github.com/jvelilla/ROC into roc_register 2016-01-15 13:30:58 +01:00
a013efd6f7 Cosmetic in DEMO_CMS_EXECUTION
Removed persistence/mysql which is not used.
2016-01-15 13:30:07 +01:00
jvelilla
2f95c66295 Removed unneeded template
Updated Sql sentence.
2016-01-14 08:39:35 -03:00
f6885ff581 remove roc.exe 2016-01-13 22:05:49 +01:00
de443a2163 Do not use ODBC by default.
(bad for default, since it depends on odbc drivers to be installed)
2016-01-13 17:30:38 +01:00
a179ee3239 Reverted executable name to "demo" 2016-01-13 10:38:27 +01:00
ed0d9c8d07 Use {CMS_LOG}.level_notice and related constant when using api.log(..) 2016-01-12 16:14:54 +01:00
67fbee737d Keep only sqlite3 persistence as default.
To include mysql and other, uncomment related code in demo-safe.ecf and demo_cms_execution.
2016-01-12 16:14:18 +01:00
jvelilla
f244e86f13 Updated user.sql added tabled auth_temp_users.
Added CMS_TEMP_USER as part of the core.
Moved the code from CMS_TEMP_USER_API and CMS_TEMP_USER_STORAGE_* to
CMS_USER_API and CMS_USER_STORAGE_*.
2016-01-12 09:34:39 -03:00
jvelilla
0cf6e59a76 Updated templates and fixed typos.
Renamed classes
2016-01-08 20:26:34 -03:00
56b9355f3c Updated email messaging of Auth modules to use the CMS_API.process_email (..) system.
as a consequence, removed usage of email_service library.
Updated the meaning for site.email to be sender email addressed.
Added notification.email to set the email address that will received system email notification.
2016-01-08 22:24:52 +01:00
jvelilla
0ca336d467 Updated templates
Replaced hardcoded name "ROC CMS" for placeholder $sitename, and
missing href's with $host.
Renamed database script and database table for temporal users.
Renamed CMS_AUTH_API AS CMS_USER_TEMP_API.
Revert design to use CMS_TEMPORAL_USER and clean CMS_USER.
Refactor rename cms_auth_storage_* classes to CMS_TEMPORAL_USER_STORAGE_*
Added Pending Registrations to the admin menu to show the list of pending registrarions
added CSS to display temporal users
2016-01-06 21:29:21 -03:00
jvelilla
5d8ea2065e Rename script name and table name for
temporary users.
Updated message, after account reactivation.
Updated message, post account application.
Updated Form name, Registration instead of Registration Form.
Updated CMS_USER to have two optional features used for temporary users.
Updated CMS_AUTH_API to user CMS_USER instead of CMS_TEMPORAL_USER
Removed CMS_TEMPORAL_USER
Updateed CMS_AUTHENTICATION_MODULE, with new permission to enable
activate, reject or reactivate a pending user registration.
Updated User Storage and API to create a new user from a temporal user.
2016-01-04 21:14:13 -03:00
jvelilla
682193d116 Updated Register Module.
Worlflow

1- Register
1.1 Create a new temporal user
1.2 Email to the new User
1.3 Email to Web Master
2 Web Master Review th Account Application
2.1 Accept and Send an confirmation email to the user and remove the temporal user
2.2 Reject the application send a rejection email to the user and remove the temporal

Added a new table to save temporal users to review their Application to the site.
Updated Register Form with an new input Application and Recaptcha validation.
Updated Emails templates and messages. (TODO improve messages)
Updated mails templates. Simple messages (Todo improve messages).
Added a new handler to reject a user
Updated existing hanlders to handler the new workflow.
2015-12-30 12:32:00 -03:00
0813abe0bb Fixed ROC CMS library compilation. 2015-12-18 15:29:43 +01:00
1094acb3ec Removed unused local variable 2015-12-16 21:05:57 +01:00
e7c9a54f3f Removed unused local. 2015-12-16 21:03:15 +01:00
bbbdac12c8 Moved taxonomy html generation to CMS_TAXONOMY_API. 2015-12-16 21:03:03 +01:00
jvelilla
22528315cb Removed unneeded file. 2015-12-16 16:01:02 +01:00
jvelilla
090a48eb85 Updated class CMS_TOKEN_GENERATOR.
Remove once in sha1 feature.
Updated encoded_base_64 to base_64
2015-12-16 16:01:01 +01:00
jvelilla
e05c4dca3a Fixed typos
Renamed class CMS_SESSION_CONSTANT to CMS_SESSION_CONSTANTS
Removed unneeded classes and files.
Update SQL implementation.
2015-12-16 16:00:59 +01:00
jvelilla
2255fcc0f6 Added Module Session Authentication with Cookies.
Updated Demo example with the Module Session (Authentication with Cookies)
Fixed little issue with SQL query in OpenID module.
2015-12-16 16:00:58 +01:00
e50fb6959e Moved taxonomy integration for web form inside CMS_TAXONOMY_API.
Moved a few helpers routine from CMS_RESPONSE to CMS_API.
Added CMS_CONTENT.identifier: detachable READABLE_STRING_32 .
2015-12-16 15:59:22 +01:00
jvelilla
3b88c746a1 Removed unneeded file. 2015-12-16 10:43:21 -03:00
jvelilla
fa8ef44a4a Merge branch 'jvelilla-roc_login_session' 2015-12-16 10:11:55 -03:00
jvelilla
068943734f Updated class CMS_TOKEN_GENERATOR.
Remove once in sha1 feature.
Updated encoded_base_64 to base_64
2015-12-16 10:03:35 -03:00
jvelilla
089179e60e Fixed typos
Renamed class CMS_SESSION_CONSTANT to CMS_SESSION_CONSTANTS
Removed unneeded classes and files.
Update SQL implementation.
2015-12-15 15:32:31 -03:00
jvelilla
c25590c9cd Added Module Session Authentication with Cookies.
Updated Demo example with the Module Session (Authentication with Cookies)
Fixed little issue with SQL query in OpenID module.
2015-12-13 18:19:25 -03:00
23d266497b Made the SQL storage more flexible with INTEGER_32, by allowing to retrieve INTEGER_64 and convert to INTEGER_32 if value can be converted to integer 32. 2015-12-10 11:26:28 +01:00
ce8de442e9 Implemented taxonomy administration pages
- create term, vocabulary, add or remove term from vocabularies, ...
Fixed content editing related to taxonomy  (especially with multiple terms vs tags).
Fixed various SQL storage issue related to taxonomy and vocabularies.
Added CMS_RESPONSE.wsf_theme as helper.
2015-12-10 11:21:20 +01:00
e3ae564746 Removed an obsolete call to CMS_RESPONSE.hooks . 2015-12-07 22:08:37 +01:00
b0626d5250 Use + instead of concat(..) in javascript. 2015-12-07 21:36:24 +01:00
276dcc6fcd Added back CMS_MODULE.register_modules (CMS_RESPONSE) as obsolete, to avoid breaking existing modules.
Note: all module SHOULD migrate to new hook setup!
2015-12-07 21:24:48 +01:00
6313007fbf Refactored and update CMS hooks design. (Move from CMS_RESPONSE to CMS_API).
Moved content_types and content_type_webform_managers from CMS_RESPONSE to CMS_API.
Updated the way to output content (node, ...) to html page.
   See CMS_CONTENT_TYPE_WEBFORM_MANAGER.append_cointent_as_html_to (...).
   Added notion of "teaser" (short version of the content), as opposed to full content.
One can use CMS_API.html_encoder ... when possible, same for `formats', ...
Added bridge from CMS_MODULE_API to CMS_API's encoders.
Added new CMS_TAXONOMY_HOOK used to retrieve list of content associated with a specific term.
Moved up to CMS_RESPONSE a few features which was available only in specific descendants.

Added /taxonomy/term/{termid} implementation.
2015-12-07 18:21:40 +01:00
ecbcb6a5cb Added notion of CMS_CONTENT as ancestor of CMS_NODE.
Moved CMS_CONTENT_TYPE to core library.
Added basic and limited taxonomy query /taxonomy/term/{termid} .
2015-12-03 23:01:31 +01:00
a5c117e46e Merge branch 'taxonomy' 2015-12-03 19:26:43 +01:00
20dfce1396 Improved taxonomy by supporting tags, multiple terms allowed, and required kind of vocabulary for specific content type.
Updated node web form, to support taxonomy editing if allowed (specific support for CMS_VOCABULARY.is_tags: BOOLEAN).
Added notion of required or optional module dependencies.
2015-12-03 19:24:58 +01:00
jvelilla
1bfc4a6741 Merge branch 'jvelilla-roc_delete_trash' 2015-12-03 06:51:37 -03:00
jvelilla
3fdbcb2eef Merge branch 'roc_delete_trash' of https://github.com/jvelilla/ROC into jvelilla-roc_delete_trash 2015-12-03 06:50:59 -03:00
jvelilla
a11a93c285 Update code to use CMS_API.unset_path_alias
Updated CMS_NODE_STORAGE_SQL renamed sql_restore_node as sql_update_note_status, updated
related code.
2015-12-02 16:14:54 -03:00
jvelilla
fade19bbee Added precondition to NODE_FORM_RESPONSE.new_delete_form
Added transaction support to CMS_NODE_STORAGE_SQL.delete_node_base
2015-12-02 12:10:03 -03:00
jvelilla
d10612f94b Made test.ecf compilable. 2015-12-02 10:56:18 -03:00
jvelilla
9da8b8a025 Fixed: delete-trash a node.
Added code to remove path_aliase when we delete a node.
2015-12-01 19:20:16 -03:00
f1f3c126dd Use module site files system for the (un)install SQL scripts.
Changed CMS_TERM.id type to INTEGER_64 .
Removed CMS_TERM.parent_id .
Implemented CMS_TERM saving.
2015-11-23 18:05:53 +01:00
1d4ce37ebf Added CMS_STORAGE.as_sql_storage: detachable CMS_STORAGE_SQL_I to ease development based on SQL database. 2015-11-23 18:03:55 +01:00
Jocelyn Fiat
10102e80fa Fixed a few grammar and style errors. 2015-11-23 16:57:49 +01:00
3791ffacdc Added first steps toward Taxonomy module. 2015-11-23 15:27:04 +01:00
b8920ee8b3 Added module administration from /admin/modules/ 2015-11-23 11:08:06 +01:00
2cf2b1da8c Merge branch 'master' of https://github.com/EiffelWebFramework/ROC 2015-11-17 22:19:34 +01:00
17ae27df40 Updated ROC CMS documentation.
Cosmetic, comments, typo.
2015-11-17 22:18:02 +01:00
Jocelyn Fiat
a976b1e21a Create doc/readme.md 2015-11-13 15:53:45 +01:00
04df6b85f0 Removed unused local variables. 2015-11-12 18:48:37 +01:00
79d30ee3a7 Added export of core data, such as users, path_aliases, custom_values.
Added export of node revisions.
2015-11-12 18:19:06 +01:00
a5973c9c8a Added exportation solution via CMS_HOOK_EXPORT.
Updated blocks settings for demo example project.
2015-11-10 10:30:10 +01:00
420051cd14 Redesigned hooks system (moving from CMS_RESPONSE to CMS_API).
Indeed, hooks does not require RESPONSE interface,
   and should be setup before, at the system level (i.e CMS_API)
Added exportation solution via CMS_HOOK_EXPORT.
Updated blocks settings for demo example project.
2015-11-09 21:07:02 +01:00
6b3ff6f980 Fixed list item computation for ini file, especially with included ini file. 2015-11-02 21:07:26 +01:00
360855a558 Fixed recent_changes module to allow alias of recent_changes blocks.
Factorized code in CMS_RESPONSE by reusing add_block.
2015-11-02 18:54:30 +01:00
6aaec0be9f Fixed table item computation for ini file, especially with included ini file. 2015-11-02 18:10:27 +01:00
cb6d13b5f7 Updated gcse library to use unique own uuid in ecf file. 2015-11-02 14:38:36 +01:00
951c977892 Use relative paths from google_search ecf files to other local cms library .ecf files. 2015-11-02 14:33:14 +01:00
2a4ebfa12e Updated google search libary ecf files to have better void-safe .ecf file. 2015-11-02 14:22:41 +01:00
955852747a Include google_search engine in example/demo installation script. 2015-11-02 11:18:45 +01:00
23fe22cad1 Google search module:
- cleanup unwanted file
- fixed bad indentation in html template.
2015-11-02 11:16:54 +01:00
da4b36869a Include the launcher during installation (install.bat). 2015-11-02 10:50:27 +01:00
5624892ebc Updated code related to cache management in CMS core and modules. 2015-11-02 10:50:05 +01:00
jvelilla
e40a7969fa Merge branch 'jvelilla-roc_gcse' 2015-10-26 10:51:51 -03:00
jvelilla
67fdd357df Merge branch 'master' of https://github.com/EiffelWebFramework/ROC into roc_gcse
Conflicts:
	examples/demo/demo-safe.ecf
2015-10-23 16:48:25 -03:00
5b0ab76434 Fixed more unicode issues, or being more flexible when loading from database. 2015-10-20 19:02:04 +02:00
a84f86d7a2 Addressed various unicode related issues.
Note this is using recent changes from text_filter library.
2015-10-20 18:49:40 +02:00
3f4e70b98c Updated roc tools, and associated scripts.
Also include Eiffel Store ODBC persistence.
2015-10-20 11:29:16 +02:00
782e9397a3 Added missing sql_finalize which is used to cleanup as early as possible the last statement when it is not needed anymore. 2015-10-19 23:33:17 +02:00
f51ddc9796 Extracted launcher code into cms/launcher/... libraries.
(mostly to help new project based on ROC CMS).
Renamed and simplified the roc cms server launcher, and the related cms execution.
Updated cms.ini and extract blocks related management into blocks.ini.
Added debug clauses for cms sqlite3 storage.
2015-10-19 22:50:48 +02:00
a260bbc2c5 Removed obsolete usage of {TYPE}.attempt from CMS_MODULE_COLLECTION. 2015-10-19 20:50:47 +02:00
eb5ae32e46 Added persistence support for Eiffel sqlite3 wrapper.
Updated existing persistency solution to be more generic to any db solution.
2015-10-19 11:24:22 +02:00
7fcacad5eb Use extended type support from EiffelStore to handle STRING_32, and other extended types. 2015-10-19 11:20:04 +02:00
7c99f2dc83 Added recent_changes.ecf 2015-10-18 20:47:33 +02:00
57430193e3 Fixed compilation of CMS_FILE_BLOCK. 2015-10-18 19:24:43 +02:00
62bf58ce6d Added support for block options for the feed aggregator blocks.
Updated weight for primary_tabs block.
2015-10-17 00:17:59 +02:00
23c395513b Fixed handling of block and optional block.
- All blocks behavior can be specified and overwritten via the configuaration.
  - And optional block are not displayed by default.
2015-10-16 23:46:18 +02:00
d2d86ecdf2 Added notion of block options, declared in cms.ini as
[blocks]
    {block_id}.options[name]=value
    {block_id}.options[size]=123
2015-10-16 23:11:44 +02:00
e90f82387f Added notion of alias block, to provide a way to include a block content in mutiple regions. 2015-10-16 23:02:47 +02:00
05472abdd7 Improved block condition "path:..." by allowing wildchar.
Added weight data to CMS_BLOCK to be able to sort the block lists,
  and thus order the display of blocks.
Set negative weight for various core block, so that they appear first as expected.
The weight can be set and overwritten in cms.ini , by pref  blocks.{block_id}.weight=integer_weight.
2015-10-16 17:22:22 +02:00
jvelilla
193760b34f Remove unneeded file. 2015-10-14 11:57:06 -03:00
jvelilla
9263f31521 Renamed module name to google_search (custom_search)
Clean code.
Updated google custom search to handle quota limit and no query submit.
Updated encoding issues for input searches: like "void safe" and "void + safe".
2015-10-14 11:51:59 -03:00
jvelilla
454d92f85b Merge https://github.com/EiffelWebFramework/ROC into roc_gcse 2015-10-14 11:45:33 -03:00
788cf3738d Fixed compilation of CMS_BLOCK_LOCATION_CONDITION (not used for now). 2015-10-14 14:20:55 +02:00
jvelilla
0e63c14613 Added Module Custom Search
Added Google custom search library
Added HTTP client extension libaray
Updated demo example to use the Module Custom Search
2015-10-13 10:23:30 -03:00
f6185612b2 Fixed compilation issue. 2015-10-12 19:42:09 +02:00
d37f45d958 Include block caches clearing during "clear_cache" hook invocation. 2015-10-12 19:39:41 +02:00
872f2a177d For now, only clear feed aggregation cache if clear all cache is requested. 2015-10-12 19:22:37 +02:00
3ed2f410d9 Added feeds.json example in feed_aggregator module folder. 2015-10-12 19:15:09 +02:00
1b451ef142 Moved the feeds.json example in associated module files. 2015-10-12 19:12:42 +02:00
50146985de Added CMS_HOOK_CACHE, and admin cache.
Prepared evolution of feed module, by allowing json object to list feeds locations.
   The associated key will be used to identify the location, and have category filter by location.
2015-10-12 19:03:12 +02:00
8cdf9ba973 Updated demo feed info. 2015-10-12 19:00:46 +02:00
8044f7d52b Implemented feed aggregation filtering based on categories. 2015-10-12 15:53:50 +02:00
ed24eb7c94 Updated theme example, to have only 2 feeds. 2015-10-09 19:47:49 +02:00
43d6b4a197 Committed module files installed for demo example. 2015-10-09 19:45:21 +02:00
dffd06e331 Implemented a basic block caching system.
- for block {block_id}, to have a cache with 3600 seconds of expiration,
    declare in the cms.ini
     [blocks]
     {block_id}.expiration=3600

Added support for size in feed aggregation with new field "size"
2015-10-09 19:38:57 +02:00
463105f29f Added feed aggregation module.
Redesigned the CMS_BLOCK system,
   - added condition attribute. It can be set via configuration file
     with
     [blocks]
      {blockid}.region={region_name}
      {blockid}.conditions[]=is_front
      {blockid}.conditions[]=path:location-path/foo/bar
   - For backward compatibility, the CMS will check only conditions for block name prefixed by "?".
Improved the configuration library to support list and table properties.
Updated theme for now, to include the feed examples.
Added "cache" classes, to ease caching of html output for instance. (TODO: improve by providing a cache manager).
2015-10-08 13:56:31 +02:00
abebd00a4f Added feed aggregation module.
Improved the CMS Block system to support condition.
2015-10-05 16:04:24 +02:00
ec53a2682b Updated notification mailer, to always store output messages.
Fixed CMS_RESPONSE, and specific error response, to return expected status code.
2015-09-28 10:47:57 +02:00
jvelilla
7b2e6ab7b4 Merge branch 'jvelilla-roc_jv_issues' 2015-09-15 14:35:35 -03:00
jvelilla
87f4de1264 Merge branch 'roc_jv_issues' of https://github.com/jvelilla/ROC into roc_jv_issues 2015-09-15 14:30:02 -03:00
jvelilla
ed614a662c Updated CMS node and blog to remove extension data.
Comments: minor update.

Updated CMS_NODE_STORAGE_I API.
Delete a node using a node as formal parameter instead of node id.
Clean code and update log information.

Added precondition to delete node to accept nodes with a valid a id.

Added missing assertions tag names.
2015-09-15 14:28:33 -03:00
jvelilla
d54ad59e5f Added missing assertions tag names. 2015-09-15 14:10:51 -03:00
jvelilla
9173ef2ded Added precondition to delete node to accept nodes with a valid a id. 2015-09-15 11:40:13 -03:00
jvelilla
ad9e908dc2 Updated CMS_NODE_STORAGE_I API.
Delete a node using a node as formal parameter instead of node id.
Clean code and update log information.
2015-09-15 10:42:30 -03:00
jvelilla
4584917877 Comments: minor update. 2015-09-15 09:02:38 -03:00
jvelilla
f7d68d09e4 Updated CMS node and blog to remove extension data. 2015-09-15 08:54:43 -03:00
f9ecd4956f Keep the until date in the form data, so that new filter will remember the until date. 2015-09-09 23:12:52 +02:00
18e159ad3c Simplified the add child mechanism, by using a query parameter ?parent=nid
(instead of specific node/{nid}/add_child/page url)
Fixed implementation of `CMS_NODE_API.is_node_a_parent_of (..)',
  and improved parent validity checking against cycle.
2015-09-09 23:04:08 +02:00
438259033a Renamed link "Trash" to "Move to trash". 2015-09-09 22:10:13 +02:00
62e74ea6cd Refactor notion of trash and delete.
- Trash a node now does a soft delete (move to trash container).
 - Delete a node now remove it from the storage (no undo).

Signed-off-by: jvelilla <javier.hector@gmail.com>
2015-09-09 22:05:23 +02:00
32a409b7e9 Refactored add child feature, to have all the page specific code in CMS_PAGE_NODE_TYPE_WEBFORM_MANAGER (and not in the general node code).
Note that ideally PAGE could be a separated page node module (as it is for blog).
Added listing of children for each "page".
2015-09-09 21:58:16 +02:00
jvelilla
eb70af6f19 CMS_NODE_API.available_parents_for_node
- Fixed comment.
     - added check to know if there are potencial cycles
     - added postcondition to ensure the list of potencial parent will not produce a cycle.

CMS_PAGE_NODE_TYPE_WEBFORM_MANAGER.update_node
     - Updated code to handle unassing parent from a node when the user
     - submit a -1 value.

NODE_FORM_RESPONSE.edit_form_validation
      - Added validation for node_parent, check if the input is valid and then
      - if exist a valid node in the list of available parents for the current node.

Signed-off-by: jvelilla <javier.hector@gmail.com>
2015-09-09 16:53:37 +02:00
5f4eb2cf10 Correct implementation of node extension save operation. 2015-09-08 20:44:00 +02:00
88bc52fffb Updated roc script, install module for the examples, and updated demo site folder. 2015-09-08 16:03:36 +02:00
jvelilla
544e6540ed Add child page support.
- Add support to create a new node as a child of an existing node.
   - Update or add a parent for a given node.
Fix delete and trash behavior: when a node is not published only the
   - author or admin see it.

Fix Node and Page node Revisions.
2015-09-08 15:57:17 +02:00
2431d7af6c Improved the recent changes modules:
- extracted from populate_recent_changes, the recent_changes_sources that enables to filter early.
Added author_name to the CMS_RECENT_CHANGE_ITEM to support author which is not related to any CMS_USER.
Implemented the simple filtering on source and add parameters size and date.
2015-09-03 14:47:17 +02:00
jvelilla
0d55bd67a2 Updated Basic Auth Module: remove the escaping from the logout message 2015-09-01 12:56:26 -03:00
jvelilla
e1727cc445 Merge branch 'jvelilla-roc_logout' 2015-09-01 11:50:37 -03:00
jvelilla
634a078282 Updated Loging form:
Display invalid credentials message inside the primary-tabs div.
Added support to submit the form using <Enter>.
2015-09-01 11:41:50 -03:00
jvelilla
2f65a084ac Updated logout message. Change message and added a div to make it easier style the site 2015-09-01 11:15:25 -03:00
jvelilla
13df6fd593 Added Logout message 2015-09-01 10:55:28 -03:00
ad4f020d0e The NULL storage may look into the CMS configuration file.
This allows to run the CMS without any database.
2015-08-21 19:16:31 +02:00
7a13b47131 Fixed cms library compilation.
CMS_FILE_BLOCK was missing `is_empty' implementation.
2015-08-19 12:34:35 +02:00
923089baa1 Better js code to apply CKEditor.replace, mainly to select only textarea.name=$name.
code cleaning.
2015-08-18 19:24:18 +02:00
cfec9dc7f8 Do not include empty blocks, this way, we avoid empty sidebars if not needed. 2015-08-18 10:58:31 +02:00
b5e7d5d201 Require "view recent changes" permission to see the recent changes. 2015-08-17 17:40:55 +02:00
e1bdcb965c Added permission arguments to "trash" and "Create" links.
Added blocks configuration settings via the cms.ini and "blocks" section
   ex: [blocks]
       navigation.region=sidebar_first
   This enables the site to change default block location, and even hides it easily, if the theme does not include associated region name.
2015-08-13 00:44:16 +02:00
0061afcbe8 use "deleted" instead of "trashed" . 2015-08-12 19:03:40 +02:00
6a9bc8aa42 Updated admin and recent_changes module permissions declaration. 2015-08-12 19:00:17 +02:00
1d7d79d69e Cleaned up hooks related code, and always go via CMS_RESPONSE.hooks 2015-08-12 17:50:23 +02:00
46014da3d8 Added recent_changes module.
Revisited hooks management, and added new CMS_HOOK_MANAGER.
Added admin, and other link into navigation menu that goes into first sidebar.
Fixed theme info, and template for sidebar ids.
Better css class name for cms node content.
2015-08-12 17:30:07 +02:00
7cb4c0e9f4 Quick fix for ROC CMS links in authentication email templates. 2015-08-10 12:55:10 +02:00
aff6b07c80 Fixing edit node form field title and id. 2015-08-10 12:49:40 +02:00
479194d6c5 Updated node module sql script file to support revisions. 2015-08-10 11:21:04 +02:00
3f123dd921 Cosmetic/comments. 2015-08-10 10:04:08 +02:00
cd0c2acd87 Added revisions support to node management.
Updated node extension implementation.
Updated known permissions for node module.
Improved code for node storage extension , in preparation to code factorization.
Ensured that author is updated when saved.
2015-08-07 19:17:25 +02:00
44ada4b6b1 Fixed demo module. 2015-08-07 19:13:01 +02:00
8efbddc8cb Removed unused local variables. 2015-08-06 11:52:47 +02:00
f26b81977c Implemented CMS_LINK.is_forbidden in all descendants. 2015-08-06 11:52:35 +02:00
bbf7456fa2 Improve permissions list display, to be sorted.
Better permission names for "admin users" and "admin roles".
2015-08-04 16:42:06 +02:00
62ef07c86b Removed unwanted files. 2015-08-04 15:22:11 +02:00
a422dea15d Improved message after successful role creation.
Removed useless code.
2015-08-04 14:56:55 +02:00
6fb7bf9a1d Updated location of http_authorization library (now under library\web\authentication\..) 2015-08-04 13:27:09 +02:00
bba1d57ce3 Fixed and improved various issue in admin module (especially the Role editing which was not working as expected.)
Added CMS_MODULE.permissions to allow module to declare the potential permissions.
Added support for CMS_LINK.is_forbidden, in relation with CMS_LOCAL_LINK.permission_arguments.
Split link "username (Logout)" into 2 links "username" and "logout".
Fixed/Changed the way auth modules alter the logout link based on "(Logout)" title, by safer solution based on `location' of the link.

Fixed usage of WSF_REQUEST.path_info by using percent_encoded_path_info which is not non unicode path info to be used most of the time.
Merged CMS_REPONSE.variables and CMS_REPONSE.values .
When possible, prefer usage of CMS_RESPONSE.user instead of CMS_REQUEST_UTIL.current_user (WSF_REQUEST) whenever it is possible.
When possible, prefer usage of CMS_RESPONSE.location, rather than usage of WSF_REQUEST.(percent_encoded_)path_info .
Code cleaning.
2015-08-04 12:48:14 +02:00
c271f839e2 Merge remote-tracking branch 'jvelilla/roc_admin' into ewf_v1 2015-08-03 14:05:03 +02:00
5d81f1d195 Improve previous commit to show allowed tabs only if user has access to it. 2015-08-03 12:56:05 +02:00
jvelilla
63f3ec12d0 Fixed issue with CMS_USER_STORAGE_SQL_I.save_user_role 2015-07-31 11:58:36 -03:00
jvelilla
863a1e7b98 Show tabs iff a user is authenticated 2015-07-30 17:36:14 -03:00
jvelilla
0fe9018ce9 Updated Admin Module, show Admin in the navigation
iff the current user is administrator.
2015-07-30 12:59:10 -03:00
jvelilla
1ef4025caa Update user storage,
Clean code
2015-07-30 11:06:03 -03:00
jvelilla
3ebffad3d6 Updated cms admin 2015-07-29 19:31:18 -03:00
500f8f78a4 Fixed implementation of CMS_USER_STORAGE_SQL_I.update_user_roles 2015-07-16 20:22:20 +02:00
47573a1950 Added permissions "$action any node" , "$action own node" for now. 2015-07-16 20:03:07 +02:00
jvelilla
2d5f985037 Merge branch 'ewf_v1' of https://github.com/EiffelWebFramework/ROC into ewf_v1 2015-07-16 13:03:18 -03:00
jvelilla
eff3552ea1 Updated block new password using Request instead of Require. 2015-07-16 13:01:53 -03:00
43b8c52d34 Merge remote-tracking branch 'ewf/ewf_v1' into ewf_v1 2015-07-16 17:18:58 +02:00
d8ac46f8b0 Added CMS_NODE.is_published and is_trashed: BOOLEAN
For now, whenever we save a node, it is marked as published.
Display a node only if published.
Updated /trash page.
Updated /nodes/ page to take into account the node status.
2015-07-16 17:16:35 +02:00
jvelilla
91f1a87b83 Added HTML5 validations.
Add required to input title.
        Added pattern to path alias with the following regex ^([A-Za-z0-9-_+ ]).+
2015-07-16 11:38:38 -03:00
769c14caf8 Display the OAuth association only in "account" page.
Improved the template to show only when pertinent.
2015-07-16 15:49:14 +02:00
3c0122d98f Fixed validation of node path alias field, for node creation.
Now,when installation a module, store the version (instead of just "yes")
2015-07-16 15:23:56 +02:00
jvelilla
77487e90f3 Added account block to link and unlink with Oauth
Updated CMS_OAUTH_20_MODULE, to handle account_info, block
2015-07-15 13:22:19 -03:00
jvelilla
5d498c0bf2 Merge branch 'ewf_v1' of https://github.com/EiffelWebFramework/ROC into ewf_v1 2015-07-15 12:25:34 -03:00
jvelilla
e42a7636ae Updated Account Info
Add Link and Unlink account with OAuth.
2015-07-15 12:24:56 -03:00
f55a52e4d0 Added CMS_USER_API.save_user_role (a_user_role) 2015-07-14 19:52:39 +02:00
2040a746dd Cleaned auth module by removing useless code.
Added CMS_USER_API.user_role_by_name (a_name: READABLE_STRING_GENERAL): detachable CMS_USER_ROLE
Added enabled/disabled status in admin/install.
2015-07-14 18:59:09 +02:00
jvelilla
d4fc9f9411 Updated account info, using a to link users to login form.
Removed unneeded file.
2015-07-14 13:08:43 -03:00
jvelilla
bba504df53 Updated Account info:
If user is not logged in, show a login option.
Updated New Password
    Added option to request a new password using username.
Updated templates to use {$site_url}
2015-07-14 10:58:16 -03:00
5688cffcf1 Fixed wrong error report for path alias validation. 2015-07-14 12:47:59 +02:00
19e8607e54 Removed unused local variable
Use new location for http_authorization library.
Added error_handler in CMS_MODULE_API (and thus all modules).
Better error handling in CMS_USER_API.
2015-07-14 12:20:43 +02:00
2d77bf6de8 Fixed change_password block template. 2015-07-13 18:48:06 +02:00
2d985ba05e Merge remote-tracking branch 'jvelilla/roc_account' into ewf_v1 2015-07-13 18:43:07 +02:00
1b0cc9dc07 Moved initialization from CMS_DEFAULT_SETUP to CMS_SETUP.initialize.
Rely on setup  "admin.installation_access" to determine who has access to /admin/install .
2015-07-13 18:42:16 +02:00
jvelilla
0164c6ec6d Updated Account Info based on review.
Updated Account info with change password form.
2015-07-13 10:25:18 -03:00
jvelilla
2fe2a7f864 Merge branch 'ewf_v1' of https://github.com/EiffelWebFramework/ROC into roc_account 2015-07-13 08:54:50 -03:00
3dec559d58 Process modules installation only for /admin/install request.
This makes installation process safer, and controlled.
2015-07-11 15:39:59 +02:00
jvelilla
dce3f71be9 Added account info, shows basic user info, logout based on login strategy.
Clean block_login.
2015-07-10 15:41:39 -03:00
3ea9e36e7c Updated comments. 2015-07-10 19:08:29 +02:00
5da01fd576 Fixed issue with CMS_USER_STORAGE_SQL_I.update_user which was passing useless parameters. 2015-07-10 18:57:56 +02:00
7f4a7b3ab9 Implemented Module enable/disable setting from configuration.
Implemented dependencies checking to set CMS_MODULE.is_enabled.
Implemented the persistence of CMS_USER.roles
2015-07-10 18:46:16 +02:00
779064a505 In SQL statement use the same case for table names, i.e all lowercase.
Otherwise on Linux+MySQL queries may fail.
2015-07-10 12:58:05 +02:00
5477bab83c Added error handler argument in CMS_STORAGE_BUILDER.storage (...) function.
Removed testing purpose code.
Update debug module.
2015-07-10 12:20:28 +02:00
d24f124e42 Fixed typo in renamed features. 2015-07-09 21:31:09 +02:00
bace9657b4 Search module configuration first in site/config/modules/$module_name/ folder to see if default is overriden,
and then in site/modules/$module_name/config/ folder.
2015-07-09 21:29:35 +02:00
6319d46f26 Added back CMS_FORMATS.filtered_html 2015-07-09 13:47:22 +02:00
31095b1b66 Merged formats, from CMS_NODE_API and CMS_API, into CMS_API.formats: CMS_FORMATS. 2015-07-09 13:41:42 +02:00
16cae0047d Revisited the format, filter and content type integration.
Now, all formats used by CMS are instances of CMS_FORMAT, mainly to prepare the admin section in order to define format by config/database.
CMS_NODE_API provides all queries to access the content types, and formats, this way a module can easily alter the formats by adding a new filter.

TODO: see how to integrate permission checking, to control who can use a specific format (such as full HTML).
2015-07-09 12:23:20 +02:00
85cff0b139 Better implementation of CMS_API.source_of_path_alias (a_alias).
That now returns the path, only if the alias exists, otherwise returns Void.
Improved path alias validation.
2015-07-07 17:40:12 +02:00
cc94c59eed Added CMS_USER.utf_8_name: STRING_8 for convenience.
Added a permission check for registering (TODO: by default allow visitor to register).
Cosmetic.
2015-07-07 17:25:56 +02:00
4c8af3ef66 Fixed implementation of path alias settings.
Now report an error if path is already aliased to another location.
2015-07-07 17:20:25 +02:00
37729f648a Merge remote-tracking branch 'ewf/ewf_v1' into ewf_v1 2015-07-03 19:35:43 +02:00
26dc018893 Added CMS_API.new_email (..): CMS_EMAIL to help CMS_EMAIL creation. 2015-07-03 19:32:49 +02:00
jvelilla
f0eff2cb98 Updated basic_auth issue with Javascript. 2015-07-03 09:28:19 -03:00
011a6b7804 Updated auto register hook with new {CMS_HOOK_RESPONSE_ALTER} 2015-07-03 09:37:40 +02:00
83e7f95425 Fixed location of .ecf file related to ROC CMS. 2015-07-03 09:33:41 +02:00
jvelilla
4f7acc5dbd Updated Javascript roc_basic_auth 2015-07-02 17:19:14 -03:00
jvelilla
922fca80ad Merge branch 'jvelilla-roc_v1_option1' into ewf_v1 2015-07-02 15:10:17 -03:00
jvelilla
9d465b3d7e Updated basic auth module, rename classes to use the prefix CMS_
Updated code based on comments
2015-07-02 14:49:33 -03:00
jvelilla
5288fe4d3c Move generic code for activation, password, reset password, re-activation to
auth module.
Updated Basic Auth module to handle specific content.
2015-07-02 12:56:10 -03:00
jvelilla
9722347736 Fixed issue with roc_auth.js 2015-07-02 10:49:58 -03:00
jvelilla
a2598fff92 Updated clean CMS_AUTHENTICATION_MODULE
Updated basic_auth module to handle templates
All the auth modules depends on CMS_AUTHENTICATION_MODULE
Send mail is done using features from CMS_AUTHENTICATION_MODULE.
Update redirect in roc_auth.js after success login to home.
2015-07-02 10:29:42 -03:00
42e7763528 Added url routing for /files/... and /module/{modname}/files/...
Added CMS_HOOK_RESPONSE_ALTER to give a last chance to alter the response before rendering.
   This hook should not be used, when there are other alternative hook that answer the need, but this is proposed for now, as a way to alter response by adding css, js url, ...
Moved blog under official modules folder.
Cleaned theme of demo example project.
Renamed NODE_MODULE as CMS_NODE_MODULE.
2015-07-01 22:50:19 +02:00
jvelilla
02fe3ba829 Merge branch 'jvelilla-roc_v1_mailer' into ewf_v1 2015-06-30 19:28:08 -03:00
jvelilla
fe3274e29a Remove unnecessary features from email service parameters for OAuth and OpenID s 2015-06-30 19:09:39 -03:00
jvelilla
96bae9f8fb Fixed typos 2015-06-30 18:52:44 -03:00
jvelilla
1cef32a1fb Updated callback url 2015-06-30 18:11:56 -03:00
jvelilla
f1e8e1da58 Updated code based on review 2015-06-30 18:06:25 -03:00
jvelilla
26276dad5d Added OpenId Module.
Better way to present handle authentication strategies in the view using tabs.
2015-06-30 16:54:09 -03:00
eb9ac980e6 Added integration configuration file all-safe.ecf
Fixed various compilation error
2015-06-30 18:18:01 +02:00
28ab4786a1 Provided a CMS_EMAIL, and CMS_API.process_email (CMS_EMAIL) 2015-06-30 16:11:49 +02:00
8294a47f17 Added usage of notification_email library.
Added CMS_SETUP.mailer
Updated implementation of email_service to use notification_email library
2015-06-30 15:53:02 +02:00
e45dac84c8 Removing unused local variables.
Fixed .ecf location for cms related libraries.
2015-06-29 18:42:11 +02:00
bb3e3b992f Merge branch 'ewf_v1_roctool' into ewf_v1 2015-06-29 17:30:39 +02:00
ebc5924c01 Made CMS_MODULE.name deferred, and implemented by constant so that it can be use as static call.
Copied site resources on related module source folder.
Renamed "login" module as "auth" module, and updated related locations and files.
2015-06-29 16:24:17 +02:00
48b0ad5195 Merge remote-tracking branch 'jvelilla/roc_tool' into ewf_v1_roctool 2015-06-26 11:25:12 +02:00
ae9eea99dd Integrate Authentication modules.
Updated code for sql that should not use parameters
   to expand :table_name in table name usage,
   since Eiffel Store will use quote,
   and MySQL does not like them.

Merge remote-tracking branch 'jvelilla/roc_auth_v1' into ewf_v1_mod_env

Conflicts:
	examples/demo/demo-safe.ecf
	modules/auth/cms_authentication_module.e
2015-06-25 23:20:51 +02:00
jvelilla
268f53e53f Fixed UUID for Oauth20 module. 2015-06-25 15:22:31 -03:00
jvelilla
e17fc570a1 Updated Demo with the new OAuth20 module
Added basic example to extend CMS Authentication using Smarty templates.
2015-06-25 13:20:04 -03:00
ba7ef17d34 Adapted to new layout, with module files inside site/modules/$module_name/... 2015-06-25 17:55:09 +02:00
jvelilla
c8bbac664b Initial commit, added new module oauth20. 2015-06-25 10:07:06 -03:00
04e98dbb48 Merge remote-tracking branch 'ewf/ewf_v1' into ewf_v1 2015-06-24 18:51:33 +02:00
2886c90782 Moved all location related queries into CMS_API, instead of CMS_SETUP.
Note that CMS_SETUP provides locations set by default or from configuration file.
Now theme related resources can be found under site/modules/$mod_name/... or site/themes/$theme/modules/...
  so only theme related resources can be overriden for now.
2015-06-24 17:15:05 +02:00
jvelilla
db6799d55b Merge branch 'jvelilla-roc_ewf_v1_email' into ewf_v1 2015-06-24 11:21:52 -03:00
jvelilla
7c0032ada4 Updated CMS:
Extract email service as a library.
Updated modules to use the email library.
Fixed compilation issue with database_connection_null.e
2015-06-24 11:17:17 -03:00
jvelilla
fa5efede2c Merge branch 'jocelyn-roc_auth_20150619' into ewf_v1 2015-06-23 15:30:01 -03:00
0fca03a4d1 Improved Authentication module code.
Updated to match recent changes from cypress the OAuth Eiffel library.
2015-06-22 21:47:06 +02:00
642b901856 Make sure CMS_BLOCK knows about page variables values.
For now only for smarty template blocks.
2015-06-19 22:48:20 +02:00
4f3bcf290f Fixing issue with index. 2015-06-19 17:58:09 +02:00
6ca8a9ce82 Fixed parts of SQL statements handling (mostly for SQL script execution). 2015-06-19 17:42:02 +02:00
2c72fe6738 Renamed login module as auth (authentication) module 2015-06-19 11:48:42 +02:00
149de898c0 Updated location for cypress the OAuth Eiffel lib.
prepare login module renaming to auth module.
2015-06-19 11:44:41 +02:00
c3133c65a1 Merge remote-tracking branch 'jvelilla/roc_email' into ewf_v1
Conflicts:
	cms.ecf
	examples/demo/demo-safe.ecf
	examples/demo/site/scripts/user.sql
	examples/demo/src/ewf_roc_server.e
2015-06-18 19:17:16 +02:00
jvelilla
9e51df1e01 Updated OAUTH consumer using STRING_8 instead of STRING_32 2015-06-18 12:35:56 -03:00
967871e427 Removed inheritance from obsolete classes. 2015-06-18 14:46:22 +02:00
73e0098c4d Removed persistence sqlite folder which is now obsolete. 2015-06-18 14:23:30 +02:00
b4407378db Fixing compilations for test suites related to persistency. 2015-06-18 14:07:41 +02:00
f619727997 Fixed persistency layer.
Now we have ODBC .. that accepts various connection string (including SQLite, MySQL,...)
  And EiffelStore+MySQL.
Updated sql scripts to work with MySQL, and SQLite.
Added a sql_statement (s: STRING): STRING that converts ROC sql statement to fit the underlying database engine.
 mostly to adapt incompatibilities such as AUTO_INCREMENT for MySQL and AUTOINCREMENT for SQLite
 by default SQL script should be written following MySQL SQL syntax.
Warning: to use ODBC persistence driver, it has to be installed on the target machine.
2015-06-18 13:55:05 +02:00
jvelilla
a94a8857ae Initial Import ROC tool 2015-06-17 20:45:28 -03:00
e37dbb0a62 Merge branch 'blog_ewf_v1' into ewf_v1 2015-06-16 21:07:40 +02:00
Jocelyn Fiat
53491274dc Merged CMS based on concurrent EWF (i.e ewf_v1) with blog branch. 2015-06-15 11:27:44 +02:00
jvelilla
afced59b0c Updated Login Module.
- Refactor raname classes and features.
        - Clean code.
2015-06-11 21:50:27 -03:00
21800e71d3 Removed obsolete calls.
Updated code to make it clear what is the resource, and what is the associated module resource path.
2015-06-11 23:03:34 +02:00
jvelilla
18732a9532 Updated Login Module.
- OAUTH LOGIN: is generic based on a new OAUTH_20_GENERIC_API
        - Storage (at the moment only SQL) for OAUTH_CONSUMER configuration.
        - OAUTH login and callback are generic.
        - Added a OAUTH_20_GENERIC_API.
        - Added scripts and templates to build the new OAUTH tables.
        - Fixed CMS_STORAGE_SQL_I.check_sql_query_validity issue.
        - Extended CMS_STORAGE_SQL_I, to execute scripts with paramerters.
        - Updated filter, now it's generic for every OAUTH consumer.
2015-06-11 10:01:36 -03:00
0fc1cb68ad Apply recent changes from EWF v1 2015-06-10 18:39:41 +02:00
0b8bee3404 favor EiffelThread for now, while waiting for SCOOP to be fully ready. 2015-06-10 11:06:58 +02:00
53a602d33c Removed CMS_SERVICE
Updated install.bat script
2015-06-10 09:43:04 +02:00
jvelilla
f652aa8a15 Update Login Module.
- Updated routes relative to /account/
     - Updated emails with template support.
     - Updated cookie to support the new route.
     - Updated smarty block templates to use the new path.
2015-06-09 19:44:52 -03:00
5578a9e622 Adapted ROC CMS to concurrent EWF.
Revisited the shared logger to reduced number of useless calls.
2015-06-09 19:42:37 +02:00
jvelilla
e188625c43 Update Login Module.
- Added an API to mange user OAuth authentication.
   - Updated the Filter to use the new API.
   - Updated the Module to initialize if it needed the storages needed by the login module.
   - Updated gmail callback to use the new API.
   - Added a Persistence Layer

CMS_USER_API
   - clean api and related persistence code.
2015-06-08 18:32:34 -03:00
jvelilla
96ba3c35a2 OAuth2 Gmail
Added OAuth2 GMAIL loggin/logout support.
      Added OAuth2 Gmail filter.
LoginModule
      Updated LoginModule with OAuth2 Gmail support.
Persitence
      Extended user persitance api with OAuth2 gmail features.
      (TODO refactor persistance as an user extention)
2015-06-08 12:58:33 -03:00
jvelilla
181c32a895 Update: refactor get_block_view. 2015-06-05 19:12:10 -03:00
jvelilla
032cc5bdcb Updated CMS with Login Module.
-- The module handle basic_auth (at the moment).
     -- Handle login, logout, register user, activate/reactivate an account, password recovery.
     -- Send notification emails.

CMS Updates
     -- Added a new service: email.
     -- Updated Basic Auth Module to handle logout based on the browser type.
     -- Updated persistence layer to save and remove and query activation token and password token.
     -- Updated CMS_USER to handle status {active, not_active, trashed}.
     -- Updated MySQL scripts to be in sync with SQLite scripts
2015-06-05 18:39:27 -03:00
b8cfff487a Removed dependency from pagination to cms_data_query_parameters
TODO: review and fix any NATURAL_64 truncation.
2015-06-02 15:56:27 +02:00
af8f410684 Updated the CMS pagination component.
Harmonized count type to NATURAL_64 for recent_nodes (more to do later).
Fix get is active code.
2015-06-02 15:39:08 +02:00
cede341301 Merged remote-tracking branch 'jvelilla/roc_pg' into pagination
Renamed pagination related classes, and moved them to cms library under "support" cluster.
2015-05-31 22:43:19 +02:00
70d53b3ef1 Provide a default CMS_MODULE.is_installed: BOOLEAN implementation based on storage of custom value.
Now use CMS_MODULE.is_initialized: BOOLEAN as precondition of many routines.
Instantiation of node storage is now done in NODE_MODULE and not any more in CMS_NODE_API.
CMS_NODE_API can be instantiated only by NODE_MODULE.
2015-05-29 19:20:31 +02:00
jvelilla
f056b43ddc Updated CMS PAGINATION with the last Jocelyn's suggestion.
Added a node pagination helper, to build the html links and header related to
pagination.
2015-05-29 09:25:28 -03:00
c871eae10e Renamed node_api and node_storage by blog_api and blog_storage in related CMS_BLOG_* classes. Mainly to avoid confusion with NODE_ classes.
Merged CMS_BLOG_CONFIG with CMS_BLOG_API.
In CMS_BLOG_API, prefer argument of type CMS_USER, rather than using directly user id.
Added a CMS_EDITOR_CONTENT_FORMAT for now, to be the format editable by the WYSIWYG editor.
Added CMS_MODULE.is_initialized: BOOLEAN to equip router, and module_api with expected preconditions.

Fixed typo, especially in log output.
Corrected a few routine names such as add_authors that should not be a function according to its name.
Converted various function returning html content, to procedure appending html content to an output string to minimize temporary string object creation.
Cosmetic: added spaces to make code easier to read, and indentation.
2015-05-27 19:00:32 +02:00
jvelilla
957ca96bc5 Updated code based on comments. 2015-05-27 11:26:49 -03:00
jvelilla
ad9dd01f22 Update based on comments 2015-05-26 20:25:45 -03:00
jvelilla
323ac598d0 Updated code based on comments 2015-05-26 20:24:05 -03:00
Dario Bösch
e35893fdb9 Integrated the CKEditor
#7 and #8: The class CMS_EDITOR generates javascript code that replaces a textarea with a wysiwyg editor. Only a few methods have to be implemented by the subclasses, for example by CMD_EDITOR_CKEDITOR. The class CMS_FORM_TEXTAREA extends WSF_FORM_TEXTAREA with features to include the javascript from CMS_EDITOR. The most complex usage is shown in CMS_NODE_TYPE_WEBFORM_MANAGER, where the textarea is only replaced if "full_html" is selected as the desired body format. This works dynamically on the browser side as soon as the user selects another format.
2015-05-23 21:11:39 +02:00
b77c5cd93c Added abstraction of cms storage on file system. (mostly helpers features). 2015-05-22 23:04:09 +02:00
77f52388c1 Improved site_url and base_url interface and initialization.
Added CMS_CUSTOM_RESPONSE_MESSAGE interface to send easily simple response message.
Updated CMS_RESPONSE to use CMS_CUSTOM_RESPONSE_MESSAGE
2015-05-22 22:37:18 +02:00
Dario Bösch
e8ff313c28 added some commments 2015-05-22 17:58:46 +02:00
Dario Bösch
0bd75e7c59 Added list of posts of a specific user
Similar to the blog handler the blog user handler routes /blogs/users/{id}. Pagination is implemented as well
2015-05-22 17:31:30 +02:00
Dario Bösch
9b169f70a7 page_number global in blog_handler 2015-05-22 15:43:29 +02:00
Dario Bösch
601b88ab36 blog handler optimized, blog user handler created 2015-05-22 15:34:32 +02:00
Dario Bösch
2b0e1a2b84 Improved structure of blog handler 2015-05-22 14:39:43 +02:00
Dario Bösch
db77c4024d created blog.scss, added link to blogs/{user}
Later we will list all posts of a user under the route blogs/{user}
2015-05-22 14:04:00 +02:00
Dario Bösch
261aeca300 Bugfix: Author was hidden
I had to add the authors to each post after getting the list. Made a helper feature add_authors.
2015-05-22 12:34:30 +02:00
Dario Bösch
027463a910 #3: added pagination links at bottom of the blog page 2015-05-22 12:02:33 +02:00
Dario Bösch
a4c50adefa #3: Calculate and show number of total pages 2015-05-22 11:48:20 +02:00
Dario Bösch
1f61126d22 Configuration File added
Created CMS_BLOG_CONFIG at moved the feature entries_per_page to this new class. The blog hander inherits from the config class
2015-05-22 11:30:54 +02:00
Dario Bösch
fb196735b6 #3: Routet page and limited entries
The blog module routes /blog/{page} and the blog handler limits the entries per page (given as a feature) and sets the offsets according to the given page number
2015-05-22 11:17:34 +02:00
jvelilla
306b39ab78 Updated code based on Jocelyn's suggestions. 2015-05-21 16:46:06 -03:00
Dario Bösch
802ad0626e Bugfix: wrong API in initialisation of blog module 2015-05-21 16:10:07 +02:00
Dario Bösch
470b1b2e05 Restructured Blog Module
All blog handlers and storage classes are detached from the nodes module. All files of the blog module are in the modules/blog folder
2015-05-21 16:04:58 +02:00
Dario Bösch
57c2a7bccd Removed the summary from the detail page 2015-05-21 14:12:01 +02:00
Dario Bösch
4dd980963a Moved filter of nodes of type blog to the node storage layer.
This is more efficient because the result set from the query will be smaller and it will be easier to implement the pagination
2015-05-21 14:06:08 +02:00
Dario Bösch
6a782e412d #2 Structure of list of posts (blog)Ordered the posts by creation date. For this, I added a field to the nodes storage and api. Show the creation date and author. Styled the post and added a more link to the detail page 2015-05-21 12:03:09 +02:00
Dario Bösch
0e0cd131a5 #1: Added the summary field to all nodes. It gets saved if we edit the node. On a node page the summary is shown first, then the main content. In the blog list the title and the summry is shown 2015-05-21 10:18:03 +02:00
jvelilla
53f3162b4a Inital page builder implementation to add paging support to cms_nodes. 2015-05-19 18:40:57 -03:00
036013a0a2 Use CMS local location (i.e relative) and not url for cms local links. 2015-05-19 22:02:56 +02:00
Dario Bösch
202253e414 Added summary field in edit and add mode of a node 2015-05-19 17:28:37 +02:00
50da24d1af Added support for base_url (i.e the CMS can be hosted on the root, or sub folder).
Local paths are relative to cms site url (i.e no starting slash).
Favor CMS_RESPONSE.absolute_url and url .. instead of using directly WSF_REQUEST.absolute_script_url and script_url.
Handled unicode truncation issue for logger.
Code cleaning.
2015-05-19 13:50:39 +02:00
91457080fd Added support for base_url (i.e the CMS can be hosted on the root, or sub folder).
Local paths are relative to cms site url (i.e no starting slash).
Favor CMS_RESPONSE.absolute_url and url .. instead of using directly WSF_REQUEST.absolute_script_url and script_url.
Handled unicode truncation issue for logger.
Code cleaning.
2015-05-19 13:44:08 +02:00
51699f3bd3 updated db schema 2015-05-19 12:25:16 +02:00
Dario Bösch
f72fcce440 Link fix 2015-05-18 15:40:47 +02:00
Dario Bösch
f48f09bfdf Bugfix (blog disappeared as create option) 2015-05-18 14:49:21 +02:00
Dario Bösch
35b186cec8 gitignore 2015-05-18 14:39:49 +02:00
Dario Bösch
c65265b025 added blog handler that lists all blog entries 2015-05-18 14:36:24 +02:00
jvelilla
77bb1fe123 Merge branch 'jvelilla-roc_trash' 2015-05-17 12:14:01 -03:00
jvelilla
e4e2d662b8 Renaming revert string to restore. 2015-05-15 13:10:12 -03:00
jvelilla
f0668e660e refactor rename NODE_HANLDER.do_restore instead of do_revert. 2015-05-15 11:34:21 -03:00
jvelilla
68fb21a4c1 Fixed typo 2015-05-15 11:01:59 -03:00
jvelilla
3b90d522f9 Refactor rename: using trashed_nodes instead of trash_nodes. 2015-05-15 10:44:04 -03:00
jvelilla
1c59a65983 Updated code based on Jocelyn suggestions. 2015-05-15 09:40:18 -03:00
jvelilla
9fbadac7ac Added trash feature: Remove or revert a node.
Added Handler to show the current trash nodes for a given user.
An admin can see all the trash nodes.
Updated storage to handle trash and revert nodes.
2015-05-14 11:07:15 -03:00
jvelilla
57bf5ad0dc Added delete option as a tab only if the current user has permissions to delete the
current resource
2015-05-13 15:17:19 -03:00
jvelilla
988f32c6c4 Merge branch 'master' of https://github.com/EiffelWebFramework/ROC into roc_trash
Conflicts:
	modules/node/handler/node_form_response.e
2015-05-13 12:38:25 -03:00
jvelilla
44d14c4100 delete with tabs 2015-05-13 12:27:02 -03:00
29ef17226b Added support for path_aliases.
Refactored CMS_MODULE.router (..): WSF_ROUTER design,
  to create only one router object of type CMS_ROUTER.
Added optional CMS_NODE.link: CMS_LOCAL_LINK
Reviewed permissions related to node module.
Refactor and add CMS_STORAGE_SQL(_BUILDER) abstractions
   for implementation relying only on SQL statements.
Factorized sql builder initialization (to work for sqlite and mysql storage builders).
Added CMS_RESPONSE.formatted_string (a_text: READABLE_STRING_GENERAL; args: TUPLE): STRING_32
Added function "translation", but not implemented for now.
Updated indexing notes and comments.
Code cleaning.
2015-05-13 17:11:39 +02:00
9514f1de9c Updated SQLITE builder using GLOBAL_SETTINGS to map 0 to 0, by default 0 -> NULL
Updated CMS_NODE_API, with status, not_published, published and trashed.
Updated Form response to use permission scopes.
Updated sqlquery to retrieve user author.
Added logger info in cms_response
Updated CMS_NODE with a new status attribute.
Updated table nodes to support trashing (or soft deletes) of node using the new status field
Updated Sqlite builder to test different scenarios for users and roles.
Updated NODE_FORM_RESPONSE.edit_form feature to add a delete operation
  if there is a node ie node id >0 and the current user has delete permission on it.
Updated NODE_HANDLER.do_post to handle the operation "DELETE".
Updated queries to retrieve nodes filter by no logical deleted rows (ie. status is trashed).


Signed-off-by: jvelilla <javier.hector@gmail.com>
2015-05-12 22:02:23 +02:00
fdff2bef36 Fixed compilation of autotests suites for sqlite and mysql.
TODO: reintroduce tests for node management.
2015-05-04 23:17:06 +02:00
1603086905 Fixed node editing workflow (especially creation/updating). 2015-04-30 19:46:18 +02:00
99b2fa9fdb Commented line registering the MYSQL storage builder,
since it reguires to setup MYSQL environment variable and so on.
So by default, we use sqlite, easier to run out of the box.
2015-04-30 19:38:17 +02:00
e17011de97 for backward compatibility alias CMS_LAYOUT to CMS_ENVIRONMENT 2015-04-30 10:05:04 +02:00
17fe37aedd Added {CMS_RESPONSE}.formats: CMS_FORMATS 2015-04-30 09:50:47 +02:00
dd3688fab8 Now node and basic_auth modules are standalone cms modules (as .ecf library)
Moved to complete void-safety
Use port 9090 for demo by configuration.
2015-04-29 23:27:36 +02:00
7771a452cf Moved src/modules under modules cluster. 2015-04-29 23:08:45 +02:00
6ff7a6493c Simplify CMS_SERVICE initialization, and CMS server (launcher).
Renamed "layout" lib as "app_env" with APPLICATION_ENVIRONMENT interface.
  applied changed to callers.
Added CMS_THEME.has_region (a_name): BOOLEAN to know if a region is declared in a defined theme.
2015-04-29 23:01:42 +02:00
0eb2b70d0f Cleaned the node module, to remove for now the REST api attempt.
This will be redone with care once the web cms is ready.
2015-04-29 20:02:09 +02:00
c982f0ea9c Implemented view node by content type (no more hardcoded cases).
Added CMS_NODE_TYPE as descendant of CMS_CONTENT_TYPE,
  in case we have content which is not a node in the future.
  (probably useless, but for now, this extra abstraction is harmful)
Moved all node related code under node module cluster.
Applied comments from Javier Velilla.
Code cleaning.
2015-04-29 17:28:33 +02:00
e8bb3790ba Removed unused variables. 2015-04-27 18:50:05 +02:00
e206c1e133 Code cleaning. 2015-04-27 18:48:51 +02:00
5582dd9058 Merge branch 'jvelilla-nodes' into nodes 2015-04-27 18:44:35 +02:00
jvelilla
d54cd6032f Added comments 2015-04-24 17:55:32 -03:00
jvelilla
8b24c86ff1 Updated Authentication JS, still work in progress 2015-04-23 11:43:57 -03:00
jvelilla
fc4c2e76b6 Added login form with Javascript (example).
Updated feature and class comments.
2015-04-22 18:40:36 -03:00
a56338ad17 Added blog module as example, this is far from being a real blog module.
but this is an example about on to add a new content type, and support it.
Fixed new node form workflow.

The current state is not final, it requires many changes, but for now, it implements a node editing workflow.
2015-04-15 22:32:38 +02:00
f2bb061488 Added support for log stored in CMS_STORAGE.
Added support for custom value stored in CMS_STORAGE.
Added optional css classes addition to CMS_BLOCK output.
Refactored storage, to manage node from node module code only (or mostly).

TODO: improved view for a cms node, for now hardcoded.
2015-04-15 16:39:03 +02:00
2b25c23977 Added helper function to CMS_RESPONSE, to deal with permissions. 2015-04-14 16:11:04 +02:00
ea2b5b87d3 Added helper functions to get uri path for a node, and other related resources.
Added description to cms content type.
Fixed initialization of node module to create test bed nodes.
2015-04-14 16:07:09 +02:00
133c243126 Implemented CMS storage for user and nodes.
Implemented role and permission storage.
Introduced the CMS_PARTIAL_NODE and CMS_PARTIAL_USER.
Added support for node storage extension
  - storage of data specific to each node content type,
  - in addition to the core CMS_NODE)
  - For now, only implemented for SQL storage.
Note: in current version, CMS_PAGE support is hard coded in the core,
    (as opposed to be only supported by the node module.)
Commented/removed for now, the Web API code to update node summary, title, via REST request.
2015-04-14 11:25:02 +02:00
Jocelyn Fiat
734f661add Merge pull request #21 from jvelilla/roc_jv_09042015
Added missing descriptions/comments
2015-04-10 10:50:52 +02:00
jvelilla
e41b0631d6 Added missing descriptions 2015-04-09 22:45:37 -03:00
jvelilla
98621cb265 Merge branch 'jocelyn-jfiat' 2015-04-09 21:44:52 -03:00
9a8683a139 Updated configuration of the example to use EiffelStore sqlite database by default. 2015-04-09 23:59:57 +02:00
f3c3407b0a Got rid of CMS_GENERIC_RESPONSE, and replace with CMS_RESPONSE_MESSAGE descendants.
Update node module to use new uri mapping, and cleaned dev purpose code.
2015-04-09 23:59:13 +02:00
20471923fd Fixed the basic auth logout by using the ://foo@hostname... workaround.
Added support for ?destination=... so that login or logout will return to previous visited page.
Revisited the sending of generic response such as access denied, unauthorized, redirection ...
Fixed support of CMS_RESPONSE.header which was  previously ignored.
Added support for CMS_RESPONSE.redirection: detachable READABLE_STRING_8, to allow easy url redirection.
Added CMS_NODE.make_empty
+ Cosmetic.
2015-04-09 23:54:14 +02:00
b235fb30a7 Updated design related to logger, to prepare move to SCOOP concurrency. 2015-04-02 21:15:05 +02:00
e94d860fd8 Commented "mysql" support to make it easier to compile at first. 2015-03-20 19:45:14 +01:00
bd6524ebe7 Fixed issue with ini config component and include functionality.
Added {CMS_SETUP}.cms_config_ini_name to define the CMS Configuration file name,
   and provide an easy way to change the name.
2015-03-09 19:27:30 +01:00
ca10c57b4b Added is_https: BOOLEAN query to CMS (on page, but also as 'is_https' value) 2015-02-16 20:14:45 +01:00
8d59d25ace 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
2015-02-16 13:01:06 +01:00
a810b1176c Revisited application layout, shared logger and relation with cms to avoid mixing various layout. 2015-02-05 10:28:46 +01:00
Jocelyn Fiat
e40f8ee4d2 Fixed location of logs folder. 2015-02-03 19:25:38 +01:00
Jocelyn Fiat
83af7f6a38 Fixed shared logger code (there was an issue on non Windows machine)
Now, it is possible to set logs folder from config file.
2015-02-03 19:19:27 +01:00
02368fe3d2 Removed unused local variable.
Updated SHARED_LOGGER to remove a few obsolete calls on json parser.
2015-01-30 19:40:10 +01:00
be0b5c23d2 Added debug output to CMS_BLOCK.
Updated SHARED_LOGGER to remove a few obsolete calls on json parser.
Added favicon.ico specific handling.
Fixed issue with theme and non raw block.
2015-01-30 19:37:12 +01:00
jvelilla
88ec1452d8 Added the new Schema for MySQL 2015-01-29 12:10:01 -03:00
5ddc2006e2 Moved library/src to src 2015-01-27 19:58:13 +01:00
d97c4b1a4a Merge branch 'master' of https://github.com/EiffelWebFramework/ROC 2015-01-27 19:49:49 +01:00
7d5869f3b9 Revisited the persistence layer.
Simplified schema to focus on user and node.
Now possible to have sqlite via ODBC and/or mysql support, and select using configuration file.
Updated demo example.
2015-01-27 19:48:37 +01:00
jvelilla
8c74c7a268 Updated log directory location if the argument `-d' is present. 2015-01-14 20:55:24 -03:00
db9e40cec4 Updated CMS_SERVICE to make the cms library complete void-safe.
Reviewed configuration related feature.
Renamed JSON_CONFIGURATION as APPLICATION_JSON_CONFIGURATION_HELPER to avoid confusion.
Updated CMS_DEFAULT_SETUP to use configuration from cms configuration library.
Added {CMS_API}.module_configuration (a_module_name: READABLE_STRING_GENERAL; a_name: detachable READABLE_STRING_GENERAL): detachable CONFIG_READER  to help getting access to configuration of a module (for now, only json and ini are supported, but in the future, this could support database layer directly)
Added CMS_HOOK_BLOCK_HELPER to reuse the template_block (..): ... function.
Cosmetic
Removed CMS_SETUP.smtp_server since for now, there is no need for such general setting.
Add header line "X-ServerEWF-App: CMS" as a simple way to know if request is processed by the CMS.
2015-01-14 18:25:26 +01:00
Javier Velilla
792880aa7a Update Module implementation 2015-01-02 10:43:17 -03:00
Javier Velilla
5ad8c680a6 Add your own Module 2014-12-31 08:06:54 -03:00
jvelilla
e2f02953f4 Refactor rename error_500_cms_response to internal_server_error_cms_response
Added bad_request_error_cms_response
Updated code example to use the new internal_server_error_cms_response instead of error_500_cms_response class.
Removed class error_500_cms_response.

Updated cms setup and configuration design:
  Removed CMS_SETUP.configuration: CMS_CONFIGURATION
  Removed CMS_CONFIGURATION and replaced it by using the configuration library.
  Added CMS_DEFAULT_SETUP.configuration: CONFIG_READER
  Addec CMS_SETUP.text_item (name): detachable READABLE_STRING_32 ...
    in order to access option not publish by the CMS_SETUP interface.
Removed CMS_SERVICE.configuration: CMS_CONFIGURATION since it was not used.

Moved configuration library from eiffel-lang to cms libraries.
Fixed issue related to ini config when parsing from string content,
  and also issue related to section included in file via @include.
Updated cms setup and configuration design:
  Removed CMS_SETUP.configuration: CMS_CONFIGURATION
  Removed CMS_CONFIGURATION and replaced it by using the configuration library.
  Added CMS_DEFAULT_SETUP.configuration: CONFIG_READER
  Addec CMS_SETUP.text_item (name): detachable READABLE_STRING_32 ...
    in order to access option not publish by the CMS_SETUP interface.
Removed CMS_SERVICE.configuration: CMS_CONFIGURATION since it was not used.
Improved the email service and related.
2014-12-19 18:03:52 -03:00
jvelilla
bd26deb6c1 Updated cms configuration file with an smtp server property.
Updated cms code to use the new property.
Removed title from the home response.
2014-12-17 09:16:19 -03:00
jvelilla
a9109ca8f7 Updated CMS_SMARTY_TEMPALTE_BLOCK, redefined out to be used by the logger.
Updated CMS_API, added wrapper features to access error_handler. has_error, reset, as_string_representation, hide
the actual error hanlder implementation.
Updated Error Filter with better logging.
2014-11-26 13:57:04 -03:00
09e5dc4032 Removed a few obsolete calls related to JSON library.
+ cosmetic
2014-11-20 15:14:34 +01:00
d082326784 Removed useless CMS_CUSTOM_SETUP. 2014-11-20 14:57:19 +01:00
51462829c7 reverted renaming to use `modules' for available modules.
Added CMS_SETUP.register_module (m) to avoid extending directly to the CMS_SETUP.modules
2014-11-20 14:53:54 +01:00
ba58fcdf75 Updated cms library with comments, and removed a few JSON obsolete calls. 2014-11-20 14:11:28 +01:00
Javier Velilla
d84f164dbd Update concepts.md
Updated concepts
2014-11-19 13:20:53 -03:00
jvelilla
c3d022ce46 Refactor raname {CMS_SETUP}.modules as {CMS_SETUP}.available_modules
Refactor raname {CMS_SETUP}.modules_enabled as {CMS_SETUP}.enabled_modules
Updated code to use the new features names.
2014-11-19 13:20:07 -03:00
jvelilla
aac01e093a Added {CMS_SETUP}.modules_enabled: CMS_MODULE_COLLECTION
Updated {CMS_SERVIDE}.intialize_modules to use the new feature {CMS_SETUP}.modules_enabled
Updated cms_hook_block description
2014-11-19 12:13:07 -03:00
jvelilla
fb62a1bb3e Merge branch 'roc_template' of https://github.com/jvelilla/ROC into roc_template 2014-11-19 11:50:56 -03:00
Javier Velilla
6162432d52 Update concepts.md
Updated Concepts table of contents
2014-11-19 11:32:59 -03:00
Javier Velilla
ebed52ae01 Update concepts.md
Updated concepts with Modules and Hooks
2014-11-19 11:16:02 -03:00
b58eeeac26 Added comments. 2014-11-19 13:34:42 +01:00
jvelilla
9169bdcd43 Removed shared_error from CMS_API
Added Missing theme and Missing tempalte classes.
Updated CMS_RESPONSE to handle missing template and send a 503 status code
with a raw response.
2014-11-19 09:22:31 -03:00
jvelilla
e36465f86d Update concepts.md
Added references to the important classes.
2014-11-18 09:26:52 -03:00
76190de218 Fixed non void-safe compilations, and cleaned .ecf files.
+Cosmetic
2014-11-18 10:05:50 +01:00
jvelilla
0edff7853b Removed default_theme.
Update theme and smarty theme description
2014-11-17 22:37:10 -03:00
jvelilla
e20a7af301 Merge pull request #15 from jvelilla/roc_template
Roc template
2014-11-17 13:08:33 -03:00
jvelilla
089b367c95 Update concepts.md
Updated default regions
2014-11-17 13:08:01 -03:00
jvelilla
503f2faf08 Update concepts.md
Updated
2014-11-17 13:03:13 -03:00
jvelilla
b887c13664 Renamed files and added tutorial document 2014-11-17 12:44:37 -03:00
jvelilla
bbfe063b5c Update CMS_concepts.md
Added table of contents
2014-11-17 12:26:58 -03:00
jvelilla
1a4e2935da Update README.md
Update readme file
2014-11-17 12:23:37 -03:00
jvelilla
c3a582f85c Added cms_concepts 2014-11-17 12:10:51 -03:00
8bfb66af30 Added cms_smarty_template_block
Added CMS_RESPONSE.module_assets_location and CMS_RESPONSE.module_assets_theme_location
    that help locating module related assets.
Added CMS_BLOCK.is_raw to abstract CMS_CONTENT_BLOCK.is_raw
2014-11-14 19:31:40 +01:00
6aad460b11 Updated ecf files, and added non void-safe .ecf files. 2014-11-14 14:20:01 +01:00
jvelilla
0dc12b82b8 Merge pull request #14 from jvelilla/roc_template
Update sqlite implemenation to make it compile
2014-11-14 08:26:06 -03:00
jvelilla
8047880c2b Update sqlite implemenation to make it compile 2014-11-13 23:46:02 -03:00
jvelilla
48283742aa Merge pull request #13 from jocelyn/minor_changes_20141113
Renamed {CMS_SETUP} theme_resource_location as theme_assets_location
2014-11-13 15:28:39 -03:00
76bdbeaa2a Renamed {CMS_SETUP} theme_resource_location as theme_assets_location
Added missing known hook in auto register hook.
Implemented /theme/* file system response.
Implemented $page.type for the smarty template.
Added CMS_DEBUG_MODULE .
Added NOT_FOUND_ERROR_CMS_RESPONSE .
2014-11-13 19:25:01 +01:00
Jocelyn Fiat
44a1dd62cb Merge pull request #12 from jvelilla/roc_template
Refactor directory structrue	d963fd2
Fixed typo in readme.md
2014-11-13 16:10:40 +01:00
jvelilla
1f8be4e37f Fixed typo in readme.md 2014-11-13 11:59:14 -03:00
jvelilla
d963fd218b Refactor directory structrue 2014-11-13 11:57:36 -03:00
Jocelyn Fiat
8ab4343d5b Merge pull request #11 from jvelilla/roc_template
Added README documentation.
Renamed examples/roc_api to demo.
Added contracts
2014-11-13 14:57:46 +01:00
jvelilla
9af6356f0a Added README doc.
Renamed example/roc_api to demo.
Added contracts
2014-11-13 10:50:54 -03:00
jvelilla
b16048eb18 Merge pull request #10 from jocelyn/copyright_20141113
Added copyright, note, and minor improvements.
2014-11-13 09:00:21 -03:00
71734a6dd7 Renamed model-safe.ecf as cms_model-safe.ecf since it is very specific to the cms.
Fixed compilation issue due to recent use of STRING_TABLE.
2014-11-13 11:15:35 +01:00
9cd53c7c78 updated readme. 2014-11-13 10:53:57 +01:00
a51d0d3c68 Added copyright, various description notes.
Added CMS_EXTERNAL_LINK, and improve various link interfaces.
Structured the model library with sub folder: user, link and content.
2014-11-13 10:50:22 +01:00
jvelilla
b3c2879b07 Merge pull request #9 from jocelyn/auto_hook_20141112
Restored implementation for auto register hooks.
2014-11-12 22:37:30 -03:00
e1feee51f9 Restore implementation for auto register hooks. 2014-11-12 22:35:24 +01:00
Jocelyn Fiat
2aaed89417 Merge pull request #8 from jvelilla/roc_template
Move libraries `layout', `model', `peristence' under cms folder
2014-11-12 21:55:25 +01:00
jvelilla
789b26eafa Move libraries layout', model', `peristence' under cms folder
Updated code to the new layout.
Added missing comments.
Remove /example/api
2014-11-12 17:24:34 -03:00
jvelilla
a576c38d42 Merge pull request #7 from jocelyn/cosmetic_20141112
Cosmetic 20141112
2014-11-12 13:19:59 -03:00
a524b80108 Made CMS_SETUP.site_url detachable.
Cosmetic, avoid long lines of comments.
Added debug ("refactor_fixme") around a few REFACTORING_HELPER.fixme (...)
Better message for a few fixme(...) related to unimplemented routines.
2014-11-12 17:13:18 +01:00
48a8ac4a1c First step toward more generic way to handle hook subscribers. 2014-11-12 16:53:42 +01:00
Jocelyn Fiat
1d4e9df917 Merge pull request #6 from jvelilla/roc_template
Updated Descriptions to classes and features
2014-11-12 16:51:23 +01:00
jvelilla
2d5c1a5e41 Updated Descriptions to classes and features 2014-11-12 12:30:09 -03:00
jvelilla
fba9b598f9 Merge pull request #5 from jocelyn/hook_20141112
name changes related to CMS HOOK and callers.
2014-11-12 12:27:00 -03:00
c3d48c47cc Renamed CMS_RESPONSE.add_..hook with subscribe_to_..._hook
Renamed CMS_RESPONSE.call_..hook  with invoke_..._hook
Renamed CMS_HOOK_VALUE_ALTER as CMS_HOOK_VALUE_TABLE_ALTER
Renamed CMS_HOOK_MENU_ALTER as CMS_HOOK_MENU_SYSTEM_ALTER
Added new CMS_HOOK_MENU_ALTER that acts on CMS_MENU object.

Cosmetic, comments.
2014-11-12 16:12:42 +01:00
jvelilla
96ceb2481a Merge pull request #4 from jvelilla/roc_template
Roc template
2014-11-12 07:07:12 -03:00
jvelilla
590bd8fc3a Merge pull request #1 from jocelyn/roc_template_jfiat
Reversed dependencies between CMS_SETUP and CMS_API(_SERVICE).
2014-11-12 06:44:37 -03:00
96da59c4cb Added notion of "front" page.
Changed CMS_HOOK_BLOCK.get_block_view to accept only attached string for `a_block_id'.
Keep simple name in CMS_MENU_SYSTEM.
Module that implements a CMS_HOOK need now to redefine CMS_MODULE.register_hooks .
Added simple code for NODE_MODULE, in order to see something.
Added CMS_URL_UTILITIES that should be used to compute url for cms path such as "/foo/bar".
Implemented get_active in CMS_RESPONSE to update the "is_active" on each link.
Added NOT_IMPLEMENTED_ERROR_CMS_RESPONSE.
Implemented a few hooks in DEMO module, for testing.
Updated smarty template related code.
2014-11-10 19:22:01 +01:00
b0930299fc Fixed assertion violation when DATABASE_NULL is instanciated. 2014-11-10 15:00:00 +01:00
abe9de621e Made examples/api compilable. 2014-11-10 14:59:30 +01:00
241b003542 Renamed CMS_API_SERVICE as CMS_API .
Reversed the design, and break dependency CMS_SETUP => CMS_API .
Now CMS_API has attribute setup: CMS_SETUP .
Moved error_handler from CMS_SETUP to CMS_API.
The instance of CMS_SETUP is used when instanciating modules.
The instance of CMS_API is used when instanciating CMS_REPONSE and Handlers/Filters.
The instance of CMS_API is passed as argument to build the CMS_MODULE.router and filter.
2014-11-10 14:59:17 +01:00
jvelilla
730f6d42a4 Updated Node module and theme to use the new rendering strategy. 2014-11-08 06:10:43 -03:00
jvelilla
75d34870fa Merged Old CMS code with new CMS code.
Pending: Update code to use the new theme
2014-11-07 18:23:25 -03:00
jvelilla
2c130cf882 Update theme information defining a navigation strategy
Updated code to use a new navigation strategy.
2014-11-07 09:15:30 -03:00
jvelilla
223a5fafdb Updated page header template 2014-11-07 07:52:44 -03:00
jvelilla
f1b911b6e3 Updated block and template to render regions 2014-11-06 22:33:48 -03:00
jvelilla
b90e3b3df0 Added a CMS_ENCODER utility class.
Added a block header template: smarty engine.
Added a menu template: smarty engine.
2014-11-05 07:45:36 -03:00
jvelilla
bafdc085d9 Added refactoring helper class to add comments. 2014-11-04 11:31:43 -03:00
jvelilla
b11462105a Initial implementation with Hooks, Regions and Templates
Updated Modules to support hooks, still work in progress.
2014-11-03 12:40:54 -03:00
jvelilla
5cb26f0b24 Updated Peristance layer to use the new error_hanler based on EWF error library.
Remove once use from DATABASE_ERROR_HANDLER.
Initial support transaction handling.
2014-10-17 08:53:02 -03:00
jvelilla
3c73202a0d Initial Import Model Library 2014-10-15 19:41:47 -03:00
jvelilla
8a06dc11ac Merge branch 'roc_pe' of https://github.com/jocelyn/ROC into roc_pe
Conflicts:
	cms/cms-safe.ecf
2014-10-14 17:22:40 -03:00
jvelilla
ab76a752d7 Added nested transaction support.
Added test cases showing transaction support scenarios.
2014-10-14 17:59:45 +02:00
jvelilla
4b9a692c2c Initial Import: Database transaction handling.
Initial Import: Error handling using ewf error library.
Added a CMS_ERROR_FILTER as part of registered filters of CMS_SERVICE
2014-10-14 17:59:45 +02:00
jvelilla
b8257e7bf0 Clean code: removed unused variables.
Move BASIC_AUTH module to ROC_SERVER setup, as an example
of module extension
2014-10-14 17:58:01 +02:00
4841039d4a Renamed void-safe ecf using -safe.ecf convention.
Added a cms_demo_module, for now pretty empty, but it will be used to develop/test the cms core.
2014-10-14 15:24:24 +02:00
jvelilla
609d71a0e9 Added nested transaction support.
Added test cases showing transaction support scenarios.
2014-10-13 18:45:45 -03:00
jvelilla
8d79447cf8 Initial Import: Database transaction handling.
Initial Import: Error handling using ewf error library.
Added a CMS_ERROR_FILTER as part of registered filters of CMS_SERVICE
2014-10-09 10:01:49 -03:00
jvelilla
36dc48125c Clean code: removed unused variables.
Move BASIC_AUTH module to ROC_SERVER setup, as an example
of module extension
2014-10-08 16:33:41 -03:00
jvelilla
d183ab8130 Merge pull request #3 from jocelyn/jfiat_roc_auth
Various design changes
2014-10-08 14:45:51 -03:00
6fc38272fe Merged back list of available modules in CMS_SETUP. 2014-10-08 19:32:30 +02:00
51e1058409 Redesign part of CMS_MODULE, and implementation.
Prepare the module before creating the service.
Remove the possibility to add module after the creation of the service.
Renamed CMS_MODULE_CONFIGURATOR as CMS_MODULE_COLLECTION.
2014-10-08 17:04:34 +02:00
jvelilla
965b0e9f7d Added CMS_MODULE_CONFIGURATOR.
Added a default implementation of CMS_MODULE_CONGIRATOR.
Updated CMS_SERVICE, to use the new CMS_MODULE_CONFIGURATOR.
Updated Example.
2014-10-08 14:36:16 +02:00
c94e5391e9 Layout: got rid of onces per thread function.
Renamed `launch_cms' as `initialize_cms' which reflects better the implementation.
Minor cosmetic or warning changes.
2014-10-08 14:24:49 +02:00
jvelilla
b004ac8ae0 Merge branch 'jvelilla-roc_auth' 2014-10-02 21:02:06 -03:00
jvelilla
c3e23e1697 Merge branch 'roc_auth' of https://github.com/jvelilla/ROC into jvelilla-roc_auth
Conflicts:
	cms/src/service/cms_service.e
2014-10-02 21:01:32 -03:00
jvelilla
3fe166b768 Updated CMS libary:
Initial Basic Authentication Node with filters.
Updated ROC API to use the new module.
2014-10-02 20:52:14 -03:00
jvelilla
a0cb7c0ecc Added Initial Basic Auth Module 2014-10-02 15:32:30 -03:00
jvelilla
e053ffceef Fixed issue with Filters. 2014-10-02 12:00:10 -03:00
746 changed files with 49772 additions and 28050 deletions

5
.gitignore vendored
View File

@@ -1,4 +1,7 @@
EIFGENs
*.swp
*.log*
*.rc
*.rc
*.bak
*.sqlite
Thumbs.db

34
README.md Normal file
View File

@@ -0,0 +1,34 @@
Eiffel CMS Library
===============
Eiffel CMS library is build with [EWF](http://eiffelwebframework.github.io/EWF/) and inspired by [Drupal](https://www.drupal.org/).
The goal of the library is to provide the following features.
- content type
- user management
- module design
- theme
- API
**Directory Structure**
- library --Library
- layout -- application layout library.
- model -- domain model library.
- persistence -- persistence layer library.
- src -- cms source code.
- example
- demo -- example using the cms library.
- doc -- Documentation.
**Documentation**
>[CMS concepts](/doc/concepts.md).
>[CMS design](/doc/design.md).
>[CMS tutorial](/doc/tutorial.md).

37
cms-safe.ecf Normal file
View File

@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-15-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-15-0 http://www.eiffel.com/developers/xml/configuration-1-15-0.xsd" name="cms" uuid="8CC0D052-57D1-4CAA-AFF1-448FA290734B" library_target="cms">
<target name="cms">
<root all_classes="true"/>
<file_rule>
<exclude>/.svn$</exclude>
<exclude>/CVS$</exclude>
<exclude>/EIFGENs$</exclude>
</file_rule>
<option warning="true" full_class_checking="false" is_attached_by_default="true" void_safety="all" syntax="transitional">
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
</option>
<mapping old_name="CMS_LAYOUT" new_name="CMS_ENVIRONMENT"/>
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<library name="base_extension" location="$ISE_LIBRARY\library\base_extension\base_extension-safe.ecf"/>
<library name="cms_app_env" location=".\library\app_env\app_env-safe.ecf"/>
<library name="cms_config" location=".\library\configuration\config-safe.ecf"/>
<library name="cms_model" location=".\library\model\cms_model-safe.ecf" readonly="false"/>
<library name="crypto" location="$ISE_LIBRARY\unstable\library\text\encryption\crypto\crypto-safe.ecf"/>
<library name="encoder" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\text\encoder\encoder-safe.ecf" readonly="false"/>
<library name="error" location="$ISE_LIBRARY\contrib\library\utility\general\error\error-safe.ecf"/>
<library name="http" location="$ISE_LIBRARY\contrib\library\network\protocol\http\http-safe.ecf"/>
<library name="i18n" location="$ISE_LIBRARY\library\i18n\i18n-safe.ecf"/>
<library name="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json-safe.ecf" readonly="false"/>
<library name="kmp_matcher" location="$ISE_LIBRARY\library\text\regexp\kmp_matcher\kmp_matcher-safe.ecf"/>
<library name="net" location="$ISE_LIBRARY\library\net\net-safe.ecf"/>
<library name="notification_mailer" location="$ISE_LIBRARY\contrib\library\runtime\process\notification_email\notification_email-safe.ecf"/>
<library name="smarty" location="$ISE_LIBRARY\contrib\library\text\template\smarty\smarty-safe.ecf" readonly="false"/>
<library name="text_filter" location="$ISE_LIBRARY\unstable\library\text\text_filter\text_filter-safe.ecf"/>
<library name="time" location="$ISE_LIBRARY\library\time\time-safe.ecf"/>
<library name="uri_template" location="$ISE_LIBRARY\contrib\library\text\parser\uri_template\uri_template-safe.ecf"/>
<library name="wsf" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf-safe.ecf"/>
<library name="wsf_extension" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf_extension-safe.ecf" readonly="false"/>
<library name="wsf_html" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf_html\wsf_html-safe.ecf" readonly="false"/>
<cluster name="src" location=".\src\" recursive="true"/>
</target>
</system>

38
cms.ecf Normal file
View File

@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-15-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-15-0 http://www.eiffel.com/developers/xml/configuration-1-15-0.xsd" name="cms" uuid="8CC0D052-57D1-4CAA-AFF1-448FA290734B" library_target="cms">
<description>ROC CMS library</description>
<target name="cms">
<root all_classes="true"/>
<file_rule>
<exclude>/.svn$</exclude>
<exclude>/CVS$</exclude>
<exclude>/EIFGENs$</exclude>
</file_rule>
<option warning="true" full_class_checking="false" void_safety="none" syntax="transitional">
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
</option>
<mapping old_name="CMS_LAYOUT" new_name="CMS_ENVIRONMENT"/>
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
<library name="base_extension" location="$ISE_LIBRARY\library\base_extension\base_extension.ecf"/>
<library name="cms_app_env" location=".\library\app_env\app_env.ecf"/>
<library name="cms_config" location=".\library\configuration\config.ecf"/>
<library name="cms_model" location=".\library\model\cms_model.ecf" readonly="false"/>
<library name="crypto" location="$ISE_LIBRARY\unstable\library\text\encryption\crypto\crypto.ecf"/>
<library name="encoder" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\text\encoder\encoder.ecf" readonly="false"/>
<library name="error" location="$ISE_LIBRARY\contrib\library\utility\general\error\error.ecf"/>
<library name="http" location="$ISE_LIBRARY\contrib\library\network\protocol\http\http.ecf"/>
<library name="i18n" location="$ISE_LIBRARY\library\i18n\i18n.ecf"/>
<library name="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json.ecf" readonly="false"/>
<library name="kmp_matcher" location="$ISE_LIBRARY\library\text\regexp\kmp_matcher\kmp_matcher.ecf"/>
<library name="net" location="$ISE_LIBRARY\library\net\net.ecf"/>
<library name="notification_mailer" location="$ISE_LIBRARY\contrib\library\runtime\process\notification_email\notification_email.ecf"/>
<library name="smarty" location="$ISE_LIBRARY\contrib\library\text\template\smarty\smarty.ecf" readonly="false"/>
<library name="text_filter" location="$ISE_LIBRARY\unstable\library\text\text_filter\text_filter.ecf"/>
<library name="time" location="$ISE_LIBRARY\library\time\time.ecf"/>
<library name="uri_template" location="$ISE_LIBRARY\contrib\library\text\parser\uri_template\uri_template.ecf"/>
<library name="wsf" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf.ecf"/>
<library name="wsf_extension" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf_extension.ecf" readonly="false"/>
<library name="wsf_html" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf_html\wsf_html.ecf" readonly="false"/>
<cluster name="src" location=".\src\" recursive="true"/>
</target>
</system>

View File

@@ -1,25 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-13-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-13-0 http://www.eiffel.com/developers/xml/configuration-1-13-0.xsd" name="cms" uuid="8CC0D052-57D1-4CAA-AFF1-448FA290734B" library_target="cms">
<target name="cms">
<root all_classes="true"/>
<option warning="true" full_class_checking="false" is_attached_by_default="true" void_safety="transitional" syntax="transitional">
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
</option>
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<library name="crypto" location="$ISE_LIBRARY\unstable\library\text\encryption\crypto\crypto-safe.ecf"/>
<library name="http" location="$ISE_LIBRARY\contrib\library\network\protocol\http\http-safe.ecf"/>
<library name="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json-safe.ecf" readonly="false"/>
<library name="layout" location="..\layout\layout.ecf"/>
<library name="persistence_mysql" location="..\persistence\implementation\mysql\persistence_mysql.ecf" readonly="false"/>
<library name="smarty" location="$ISE_LIBRARY\contrib\library\text\template\smarty\smarty-safe.ecf" readonly="false"/>
<library name="wsf" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf-safe.ecf"/>
<library name="wsf_extension" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf_extension-safe.ecf" readonly="false"/>
<cluster name="src" location=".\src\" recursive="true">
<file_rule>
<exclude>/EIFGENs$</exclude>
<exclude>/CVS$</exclude>
<exclude>/.svn$</exclude>
</file_rule>
</cluster>
</target>
</system>

View File

@@ -1,298 +0,0 @@
class
CMS_CONFIGURATION
inherit
ANY
SHARED_EXECUTION_ENVIRONMENT
export
{NONE} all
end
create
make
feature {NONE} -- Initialization
make (a_layout: CMS_LAYOUT)
-- Initialize `Current'.
local
p: PATH
do
layout := a_layout
create options.make_equal (10)
configuration_location := layout.cms_config_ini_path
import_from_path (layout.cms_config_ini_path)
analyze
end
analyze
do
get_root_location
get_var_location
get_themes_location
get_files_location
end
feature -- Access
configuration_location: detachable PATH
option (a_name: READABLE_STRING_GENERAL): detachable ANY
do
Result := options.item (a_name)
end
options: STRING_TABLE [STRING_32]
feature -- Conversion
append_to_string (s: STRING)
local
utf: UTF_CONVERTER
do
s.append ("Options:%N")
across
options as c
loop
s.append (c.key.to_string_8)
s.append_character ('=')
utf.string_32_into_utf_8_string_8 (c.item, s)
s.append_character ('%N')
end
s.append ("Specific:%N")
s.append ("root_location=" + root_location.utf_8_name + "%N")
s.append ("var_location=" + var_location.utf_8_name + "%N")
s.append ("files_location=" + files_location.utf_8_name + "%N")
s.append ("themes_location=" + themes_location.utf_8_name + "%N")
end
feature -- Element change
set_option (a_name: READABLE_STRING_GENERAL; a_value: STRING_32)
do
options.force (a_value, a_name.as_string_8)
end
feature -- Access
var_location: PATH
root_location: PATH
files_location: PATH
themes_location: PATH
theme_name (dft: detachable like theme_name): READABLE_STRING_8
do
if attached options.item ("theme") as s then
Result := s
elseif dft /= Void then
Result := dft
else
Result := "default"
end
end
site_id: READABLE_STRING_8
do
if attached options.item ("site.id") as s then
Result := s
else
Result := "_EWF_CMS_NO_ID_"
end
end
site_name (dft: like site_name): READABLE_STRING_8
do
if attached options.item ("site.name") as s then
Result := s
else
Result := dft
end
end
site_url (dft: like site_url): READABLE_STRING_8
do
if attached options.item ("site.url") as s then
Result := s
else
Result := dft
end
if Result /= Void then
if Result.is_empty then
-- ok
elseif not Result.ends_with ("/") then
Result := Result + "/"
end
end
end
site_script_url (dft: like site_script_url): detachable READABLE_STRING_8
do
if attached options.item ("site.script_url") as s then
Result := s
else
Result := dft
end
if Result /= Void then
if Result.is_empty then
elseif not Result.ends_with ("/") then
Result := Result + "/"
end
end
end
site_email (dft: like site_email): READABLE_STRING_8
do
if attached options.item ("site.email") as s then
Result := s
else
Result := dft
end
end
feature -- Change
get_var_location
local
utf: UTF_CONVERTER
do
if attached options.item ("var-dir") as s then
create var_location.make_from_string (utf.utf_8_string_8_to_escaped_string_32 (s))
else
var_location := execution_environment.current_working_path
end
end
get_root_location
local
utf: UTF_CONVERTER
do
root_location := layout.www_path
end
get_files_location
local
utf: UTF_CONVERTER
do
if attached options.item ("files-dir") as s then
create files_location.make_from_string (utf.utf_8_string_8_to_escaped_string_32 (s))
else
create files_location.make_from_string ("files")
end
end
get_themes_location
local
utf: UTF_CONVERTER
do
if attached options.item ("themes-dir") as s then
create themes_location.make_from_string (utf.utf_8_string_8_to_escaped_string_32 (s))
else
themes_location := root_location.extended ("themes")
end
end
feature {NONE} -- Implementation
import_from_file (fn: READABLE_STRING_GENERAL)
do
import_from_path (create {PATH}.make_from_string (fn))
end
import_from_path (a_filename: PATH)
-- Import ini file content
local
f: PLAIN_TEXT_FILE
l,v: STRING_8
p: INTEGER
do
create f.make_with_path (a_filename)
if f.exists and f.is_readable then
f.open_read
from
f.read_line
until
f.exhausted
loop
l := f.last_string
l.left_adjust
if not l.is_empty then
if l[1] = '#' then
-- commented line
else
p := l.index_of ('=', 1)
if p > 1 then
v := l.substring (p + 1, l.count)
l.keep_head (p - 1)
v.left_adjust
v.right_adjust
l.right_adjust
if l.is_case_insensitive_equal ("@include") then
import_from_file (resolved_string (v))
else
set_option (l.as_lower, resolved_string (v))
end
end
end
end
f.read_line
end
f.close
end
end
feature {NONE} -- Environment
resolved_string (s: READABLE_STRING_8): STRING_32
-- Resolved `s' using `options' or else environment variables.
local
i,n,b,e: INTEGER
k: detachable READABLE_STRING_8
do
from
i := 1
n := s.count
create Result.make (s.count)
until
i > n
loop
if i + 1 < n and then s[i] = '$' and then s[i+1] = '{' then
b := i + 2
e := s.index_of ('}', b) - 1
if e > 0 then
k := s.substring (b, e)
if attached option (k) as v then
if attached {READABLE_STRING_32} v as s32 then
Result.append (s32)
else
Result.append (v.out)
end
i := e + 1
elseif attached execution_environment.item (k) as v then
Result.append (v)
i := e + 1
else
Result.extend (s[i])
end
else
Result.extend (s[i])
end
else
Result.extend (s[i])
end
i := i + 1
end
end
feature -- Implementation
layout: CMS_LAYOUT
-- Cms layout
end

View File

@@ -1,123 +0,0 @@
note
description: "Summary description for {CMS_DEFAULT_SETUP}."
date: "$Date$"
revision: "$Revision$"
class
CMS_DEFAULT_SETUP
inherit
CMS_SETUP
REFACTORING_HELPER
create
make
feature {NONE} -- Initialization
make (a_layout: CMS_LAYOUT)
do
layout := a_layout
create configuration.make (layout)
site_id := configuration.site_id
site_url := configuration.site_url ("")
site_name := configuration.site_name ("EWF::CMS")
site_email := configuration.site_email ("webmaster")
site_dir := configuration.root_location
site_var_dir := configuration.var_location
files_location := configuration.files_location
themes_location := configuration.themes_location
theme_name := configuration.theme_name ("default")
compute_theme_location
compute_theme_resource_location
initialize
end
initialize
do
build_api_service
build_auth_engine
build_mailer
build_modules
end
feature -- Access
modules: ARRAYED_LIST [CMS_MODULE]
-- List of possible modules
is_html: BOOLEAN
-- <Precursor>
do
-- Enable change the mode
Result := (create {CMS_JSON_CONFIGURATION}).is_html_mode(layout.application_config_path)
end
is_web: BOOLEAN
-- <Precursor>
do
Result := (create {CMS_JSON_CONFIGURATION}).is_web_mode(layout.application_config_path)
end
feature {NONE} -- Initialization
build_modules
-- Core modules. (User, Admin, Node)
-- At the moment only node is supported.
local
m: CMS_MODULE
do
create modules.make (3)
-- -- Core
-- create {USER_MODULE} m.make
-- m.enable
-- modules.extend (m)
-- create {ADMIN_MODULE} m.make
-- m.enable
-- modules.extend (m)
create {NODE_MODULE} m.make (Current)
m.enable
modules.extend (m)
end
build_api_service
local
dn: PATH
l_database: DATABASE_CONNECTION
do
to_implement ("Refactor database setup")
if attached (create {JSON_CONFIGURATION}).new_database_configuration (layout.application_config_path) as l_database_config then
create {DATABASE_CONNECTION_MYSQL} l_database.login_with_connection_string (l_database_config.connection_string)
create api_service.make (create {CMS_STORAGE_MYSQL}.make (l_database))
else
create {DATABASE_CONNECTION_NULL} l_database.make_common
create api_service.make (create {CMS_STORAGE_NULL})
end
end
build_auth_engine
do
to_implement ("Not implemented authentication")
end
build_mailer
do
to_implement ("Not implemented mailer")
end
feature -- Change
add_module (m: CMS_MODULE)
-- Add a module `m' to the list of modules `modules'.
do
modules.force (m)
end
end

View File

@@ -1,47 +0,0 @@
note
description: "Summary description for {CMS_JSON_CONFIGURATION}."
date: "$Date$"
revision: "$Revision$"
class
CMS_JSON_CONFIGURATION
inherit
JSON_CONFIGURATION
feature -- Access
is_html_mode (a_path: PATH): BOOLEAN
-- Is the server running on web mode?
local
l_parser: JSON_PARSER
do
if attached json_file_from (a_path) as json_file then
l_parser := new_json_parser (json_file)
if attached {JSON_OBJECT} l_parser.parse as jv and then l_parser.is_parsed and then
attached {JSON_OBJECT} jv.item ("server") as l_server and then
attached {JSON_STRING} l_server.item ("mode") as l_mode then
Result := l_mode.item.is_case_insensitive_equal_general ("html")
end
end
end
is_web_mode (a_path: PATH): BOOLEAN
-- Is the server running on web mode?
local
l_parser: JSON_PARSER
do
if attached json_file_from (a_path) as json_file then
l_parser := new_json_parser (json_file)
if attached {JSON_OBJECT} l_parser.parse as jv and then l_parser.is_parsed and then
attached {JSON_OBJECT} jv.item ("server") as l_server and then
attached {JSON_STRING} l_server.item ("mode") as l_mode then
Result := l_mode.item.is_case_insensitive_equal_general ("web")
end
end
end
end

View File

@@ -1,32 +0,0 @@
note
description: "Summary description for {CMS_LAYOUT}."
date: "$Date$"
revision: "$Revision$"
class
CMS_LAYOUT
inherit
APPLICATION_LAYOUT
create
make_default,
make_with_path
feature -- Access
theme_path: PATH
-- Directory for templates (HTML, etc).
once
Result := www_path.extended ("theme")
end
cms_config_ini_path: PATH
-- Database Configuration file path.
once
Result := config_path.extended ("cms.ini")
end
end

View File

@@ -1,85 +0,0 @@
note
description: "Summary description for {CMS_SETUP}."
date: "$Date$"
revision: "$Revision$"
deferred class
CMS_SETUP
feature -- Access
configuration: CMS_CONFIGURATION
-- cms configuration.
layout: CMS_LAYOUT
-- CMS layout.
api_service: CMS_API_SERVICE
-- cms api service.
modules: LIST[CMS_MODULE]
-- Possible list of modules.
-- |If we remove Modules from setup.
-- |we can let the CMS_SERVICE define the basic modules.
deferred
end
is_html: BOOLEAN
-- api with progresive enhacements css and js, server side rendering.
deferred
end
is_web: BOOLEAN
-- web: Web Site with progresive enhacements css and js and Ajax calls.
deferred
end
feature -- Access: Site
site_id: READABLE_STRING_8
site_name: READABLE_STRING_32
site_email: READABLE_STRING_8
site_url: READABLE_STRING_8
site_dir: PATH
site_var_dir: PATH
files_location: PATH
feature -- Access:Theme
themes_location: PATH
theme_location: PATH
theme_resource_location: PATH
--
theme_information_location: PATH
-- theme informations.
do
Result := theme_location.extended ("theme.info")
end
theme_name: READABLE_STRING_32
-- theme name
feature -- Compute location
compute_theme_location
do
theme_location := themes_location.extended (theme_name)
end
compute_theme_resource_location
-- assets (js, css, images, etc)
-- Not used at the moment.
do
theme_resource_location := theme_location
end
end

View File

@@ -1,48 +0,0 @@
note
description: "Summary description for {WSF_CMS_MODULE}."
date: "$Date$"
revision: "$Revision$"
deferred class
CMS_MODULE
feature -- Access
is_enabled: BOOLEAN
name: STRING
description: STRING
package: STRING
version: STRING
feature -- Router
router: WSF_ROUTER
-- Router configuration.
deferred
end
feature -- Settings
enable
do
is_enabled := True
end
disable
do
is_enabled := False
end
feature -- Hooks
help_text (a_path: STRING): STRING
do
create Result.make_empty
end
end

View File

@@ -1,174 +0,0 @@
note
description: "Summary description for {NEW_CONTENT_HANDLER}."
date: "$Date$"
revision: "$Revision$"
class
NODE_CONTENT_HANDLER
inherit
CMS_HANDLER
WSF_FILTER
WSF_URI_HANDLER
rename
execute as uri_execute,
new_mapping as new_uri_mapping
end
WSF_URI_TEMPLATE_HANDLER
rename
execute as uri_template_execute,
new_mapping as new_uri_template_mapping
select
new_uri_template_mapping
end
WSF_RESOURCE_HANDLER_HELPER
redefine
do_get,
do_post,
do_put
end
REFACTORING_HELPER
create
make
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
uri_template_execute (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Execute request handler
do
execute_methods (req, res)
end
feature -- HTTP Methods
do_get (req: WSF_REQUEST; res: WSF_RESPONSE)
-- <Precursor>
local
l_page: CMS_RESPONSE
do
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_service.node (l_id.integer_value) as l_node then
create {GENERIC_VIEW_CMS_RESPONSE} l_page.make (req, res, setup, "modules/node_content")
l_page.add_variable (l_node.content, "content")
l_page.add_variable (l_id.value, "id")
l_page.execute
else
do_error (req, res, l_id)
end
else
(create {ERROR_500_CMS_RESPONSE}.make (req, res, setup, "master2/error")).execute
end
else
(create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
end
end
do_post (req: WSF_REQUEST; res: WSF_RESPONSE)
-- <Precursor>
local
l_page: CMS_RESPONSE
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_service.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)
else
(create {ERROR_500_CMS_RESPONSE}.make (req, res, setup, "master2/error")).execute
end
end
else
do_error (req, res, l_id)
end
else
(create {ERROR_500_CMS_RESPONSE}.make (req, res, setup, "master2/error")).execute
end
else
(create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
end
end
do_put (req: WSF_REQUEST; res: WSF_RESPONSE)
-- <Precursor>
local
u_node: CMS_NODE
l_page: CMS_RESPONSE
do
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_service.node (l_id.integer_value) as l_node then
u_node := extract_data_form (req)
u_node.set_id (l_id.integer_value)
api_service.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)
end
else
(create {ERROR_500_CMS_RESPONSE}.make (req, res, setup, "master2/error")).execute
end
else
(create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
end
end
feature -- Error
do_error (req: WSF_REQUEST; res: WSF_RESPONSE; a_id: WSF_STRING)
-- Handling error.
local
l_page: CMS_RESPONSE
do
create {GENERIC_VIEW_CMS_RESPONSE} l_page.make (req, res, setup, "master2/error")
l_page.add_variable (req.absolute_script_url (req.path_info), "request")
if a_id.is_integer then
-- resource not found
l_page.add_variable ("404", "code")
l_page.set_status_code (404)
else
-- bad request
l_page.add_variable ("400", "code")
l_page.set_status_code (400)
end
l_page.execute
end
feature -- {NONE} Form data
extract_data_form (req: WSF_REQUEST): CMS_NODE
-- Extract request form data and build a object
-- Node
do
create Result.make ("", "", "")
if attached {WSF_STRING}req.form_parameter ("content") as l_content then
Result.set_content (l_content.value)
end
end
end

View File

@@ -1,218 +0,0 @@
note
description: "Summary description for {NODE_HANDLER}."
date: "$Date$"
revision: "$Revision$"
class
NODE_HANDLER
inherit
CMS_HANDLER
WSF_FILTER
WSF_URI_HANDLER
rename
execute as uri_execute,
new_mapping as new_uri_mapping
end
WSF_URI_TEMPLATE_HANDLER
rename
execute as uri_template_execute,
new_mapping as new_uri_template_mapping
select
new_uri_template_mapping
end
WSF_RESOURCE_HANDLER_HELPER
redefine
do_get,
do_post,
do_put,
do_delete
end
REFACTORING_HELPER
create
make
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
uri_template_execute (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Execute request handler
do
execute_methods (req, res)
end
feature -- HTTP Methods
do_get (req: WSF_REQUEST; res: WSF_RESPONSE)
-- <Precursor>
local
l_page: CMS_RESPONSE
do
-- 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_service.node (l_id.integer_value) as l_node then
create {GENERIC_VIEW_CMS_RESPONSE} l_page.make (req, res, setup,"modules/node")
l_page.add_variable (l_node, "node")
l_page.execute
else
do_error (req, res, l_id)
end
else
-- Factory
new_node (req, res)
end
end
do_post (req: WSF_REQUEST; res: WSF_RESPONSE)
-- <Precursor>
local
u_node: CMS_NODE
l_page: CMS_RESPONSE
do
to_implement ("Check user 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_service.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 ("DELETE") then
do_delete (req, res)
elseif l_method.is_case_insensitive_equal ("PUT") then
do_put (req, res)
else
(create {ERROR_500_CMS_RESPONSE}.make (req, res, setup, "master2/error")).execute
end
end
else
do_error (req, res, l_id)
end
else
-- New node
u_node := extract_data_form (req)
u_node.set_author (l_user)
api_service.new_node (u_node)
(create {CMS_GENERIC_RESPONSE}).new_response_redirect (req, res, req.absolute_script_url (""))
end
else
(create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
end
end
do_put (req: WSF_REQUEST; res: WSF_RESPONSE)
-- <Precursor>
local
u_node: CMS_NODE
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_service.node (l_id.integer_value) as l_node then
u_node := extract_data_form (req)
u_node.set_id (l_id.integer_value)
api_service.update_node (l_user.id,u_node)
(create {CMS_GENERIC_RESPONSE}).new_response_redirect (req, res, req.absolute_script_url (""))
else
do_error (req, res, l_id)
end
else
(create {ERROR_500_CMS_RESPONSE}.make (req, res, setup, "master2/error")).execute
end
else
(create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
end
end
do_delete (req: WSF_REQUEST; res: WSF_RESPONSE)
-- <Precursor>
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_service.node (l_id.integer_value) as l_node then
api_service.delete_node (l_id.integer_value)
(create {CMS_GENERIC_RESPONSE}).new_response_redirect (req, res, req.absolute_script_url (""))
else
do_error (req, res, l_id)
end
else
(create {ERROR_500_CMS_RESPONSE}.make (req, res, setup, "master2/error")).execute
end
else
(create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
end
end
feature -- Error
do_error (req: WSF_REQUEST; res: WSF_RESPONSE; a_id: WSF_STRING)
-- Handling error.
local
l_page: CMS_RESPONSE
do
create {GENERIC_VIEW_CMS_RESPONSE} l_page.make (req, res, setup, "master2/error")
l_page.add_variable (req.absolute_script_url (req.path_info), "request")
if a_id.is_integer then
-- resource not found
l_page.add_variable ("404", "code")
l_page.set_status_code (404)
else
-- bad request
l_page.add_variable ("400", "code")
l_page.set_status_code (400)
end
l_page.execute
end
feature {NONE} -- Node
new_node (req: WSF_REQUEST; res: WSF_RESPONSE)
local
l_page: CMS_RESPONSE
do
if attached current_user_name (req) then
create {GENERIC_VIEW_CMS_RESPONSE} l_page.make (req, res, setup, "modules/node")
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
end
feature -- {NONE} Form data
extract_data_form (req: WSF_REQUEST): CMS_NODE
-- Extract request form data and build a object
-- Node
do
create Result.make ("", "", "")
if attached {WSF_STRING} req.form_parameter ("title") as l_title then
Result.set_title (l_title.value)
end
if attached {WSF_STRING} req.form_parameter ("summary") as l_summary then
Result.set_summary (l_summary.value)
end
if attached {WSF_STRING} req.form_parameter ("content") as l_content then
Result.set_content (l_content.value)
end
end
end

View File

@@ -1,173 +0,0 @@
note
description: "Summary description for {NODE_SUMMARY_HANDLER}."
date: "$Date$"
revision: "$Revision$"
class
NODE_SUMMARY_HANDLER
inherit
CMS_HANDLER
WSF_FILTER
WSF_URI_HANDLER
rename
execute as uri_execute,
new_mapping as new_uri_mapping
end
WSF_URI_TEMPLATE_HANDLER
rename
execute as uri_template_execute,
new_mapping as new_uri_template_mapping
select
new_uri_template_mapping
end
WSF_RESOURCE_HANDLER_HELPER
redefine
do_get,
do_post,
do_put
end
REFACTORING_HELPER
create
make
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
uri_template_execute (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Execute request handler
do
execute_methods (req, res)
end
feature -- HTTP Methods
do_get (req: WSF_REQUEST; res: WSF_RESPONSE)
-- <Precursor>
local
l_page: CMS_RESPONSE
do
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_service.node (l_id.integer_value) as l_node then
create {GENERIC_VIEW_CMS_RESPONSE} l_page.make (req, res, setup, "modules/node_summary")
l_page.add_variable (l_node.summary, "summary")
l_page.add_variable (l_id.value, "id")
l_page.execute
else
do_error (req, res, l_id)
end
else
(create {ERROR_500_CMS_RESPONSE}.make (req, res, setup, "master2/error")).execute
end
else
(create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
end
end
do_post (req: WSF_REQUEST; res: WSF_RESPONSE)
-- <Precursor>
local
u_node: CMS_NODE
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_service.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)
else
(create {ERROR_500_CMS_RESPONSE}.make (req, res, setup, "master2/error")).execute
end
end
else
do_error (req, res, l_id)
end
else
(create {ERROR_500_CMS_RESPONSE}.make (req, res, setup, "master2/error")).execute
end
else
(create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
end
end
do_put (req: WSF_REQUEST; res: WSF_RESPONSE)
-- <Precursor>
local
u_node: CMS_NODE
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_service.node (l_id.integer_value) as l_node then
u_node := extract_data_form (req)
u_node.set_id (l_id.integer_value)
api_service.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)
end
else
(create {ERROR_500_CMS_RESPONSE}.make (req, res, setup, "master2/error")).execute
end
else
(create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
end
end
feature -- Error
do_error (req: WSF_REQUEST; res: WSF_RESPONSE; a_id: WSF_STRING)
-- Handling error.
local
l_page: CMS_RESPONSE
do
create {GENERIC_VIEW_CMS_RESPONSE} l_page.make (req, res, setup, "master2/error")
l_page.add_variable (req.absolute_script_url (req.path_info), "request")
if a_id.is_integer then
-- resource not found
l_page.add_variable ("404", "code")
l_page.set_status_code (404)
else
-- bad request
l_page.add_variable ("400", "code")
l_page.set_status_code (400)
end
l_page.execute
end
feature -- {NONE} Form data
extract_data_form (req: WSF_REQUEST): CMS_NODE
-- Extract request form data and build a object
-- Node
do
create Result.make ("", "", "")
if attached {WSF_STRING}req.form_parameter ("summary") as l_summary then
Result.set_summary (l_summary.value)
end
end
end

View File

@@ -1,177 +0,0 @@
note
description: "Summary description for {NODE_TITLE_HANDLER}."
date: "$Date$"
revision: "$Revision$"
class
NODE_TITLE_HANDLER
inherit
CMS_HANDLER
WSF_FILTER
WSF_URI_HANDLER
rename
execute as uri_execute,
new_mapping as new_uri_mapping
end
WSF_URI_TEMPLATE_HANDLER
rename
execute as uri_template_execute,
new_mapping as new_uri_template_mapping
select
new_uri_template_mapping
end
WSF_RESOURCE_HANDLER_HELPER
redefine
do_get,
do_post,
do_put
end
REFACTORING_HELPER
create
make
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
uri_template_execute (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Execute request handler
do
execute_methods (req, res)
end
feature -- HTTP Methods
do_get (req: WSF_REQUEST; res: WSF_RESPONSE)
-- <Precursor>
local
l_page: CMS_RESPONSE
do
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_service.node (l_id.integer_value) as l_node then
create {GENERIC_VIEW_CMS_RESPONSE} l_page.make (req, res, setup, "modules/node_title")
l_page.add_variable (setup.is_html, "html")
l_page.add_variable (setup.is_web, "web")
l_page.add_variable (l_node.title, "title")
l_page.add_variable (l_id.value, "id")
l_page.execute
else
do_error (req, res, l_id)
end
else
to_implement ("Check how to implement API error")
-- create l_page.make (req, "master2/error")
-- l_page.set_value ("500", "code")
-- l_page.set_value (req.absolute_script_url (req.path_info), "request")
-- l_page.send_to (res)
end
else
(create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
end
end
do_post (req: WSF_REQUEST; res: WSF_RESPONSE)
-- <Precursor>
local
u_node: CMS_NODE
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_service.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)
else
(create {ERROR_500_CMS_RESPONSE}.make (req, res, setup, "master2/error")).execute
end
end
else
do_error (req, res, l_id)
end
else
(create {ERROR_500_CMS_RESPONSE}.make (req, res, setup, "master2/error")).execute
end
else
(create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
end
end
do_put (req: WSF_REQUEST; res: WSF_RESPONSE)
-- <Precursor>
local
u_node: CMS_NODE
do
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_service.node (l_id.integer_value) as l_node then
u_node := extract_data_form (req)
u_node.set_id (l_id.integer_value)
api_service.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)
end
else
(create {ERROR_500_CMS_RESPONSE}.make (req, res, setup, "master2/error")).execute
end
else
(create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
end
end
feature -- Error
do_error (req: WSF_REQUEST; res: WSF_RESPONSE; a_id: WSF_STRING)
-- Handling error.
local
l_page: CMS_RESPONSE
do
create {GENERIC_VIEW_CMS_RESPONSE} l_page.make (req, res, setup, "master2/error")
l_page.add_variable (req.absolute_script_url (req.path_info), "request")
if a_id.is_integer then
-- resource not found
l_page.add_variable ("404", "code")
l_page.set_status_code (404)
else
-- bad request
l_page.add_variable ("400", "code")
l_page.set_status_code (400)
end
l_page.execute
end
feature -- {NONE} Form data
extract_data_form (req: WSF_REQUEST): CMS_NODE
-- Extract request form data and build a object
-- Node
do
create Result.make ("", "", "")
if attached {WSF_STRING} req.form_parameter ("title") as l_title then
Result.set_title (l_title.value)
end
end
end

View File

@@ -1,59 +0,0 @@
note
description: "Summary description for {NODES_HANDLER}."
date: "$Date$"
revision: "$Revision$"
class
NODES_HANDLER
inherit
CMS_HANDLER
WSF_FILTER
WSF_URI_HANDLER
rename
execute as uri_execute,
new_mapping as new_uri_mapping
end
WSF_RESOURCE_HANDLER_HELPER
redefine
do_get
end
REFACTORING_HELPER
create
make
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
feature -- HTTP Methods
do_get (req: WSF_REQUEST; res: WSF_RESPONSE)
-- <Precursor>
local
l_page: CMS_RESPONSE
do
-- At the moment the template is hardcoded, but we can
-- get them from the configuration file and load them into
-- the setup class.
create {GENERIC_VIEW_CMS_RESPONSE} l_page.make (req, res, setup, "modules/nodes")
l_page.add_variable (api_service.nodes, "nodes")
l_page.execute
end
end

View File

@@ -1,127 +0,0 @@
note
description: "Summary description for {CMS_MODULE}."
date: "$Date$"
revision: "$Revision$"
class
NODE_MODULE
inherit
CMS_MODULE
create
make
feature {NONE} -- Initialization
make (a_config: CMS_SETUP)
do
name := "node"
version := "1.0"
description := "Service to manage content based on 'node'"
package := "core"
config := a_config
setup_router
enable
end
feature -- Access
router: WSF_ROUTER
-- Node router.
config: CMS_SETUP
-- Node configuration.
feature -- Implementation
setup_router
-- Setup `router'.
do
create router.make (5)
configure_api_node
configure_api_nodes
configure_api_node_title
configure_api_node_summary
configure_api_node_content
end
feature -- Configure Node Resources Routes
configure_api_node
local
l_node_handler: NODE_HANDLER
l_methods: WSF_REQUEST_METHODS
do
create l_node_handler.make (config)
create l_methods
l_methods.enable_get
l_methods.enable_post
l_methods.enable_put
router.handle_with_request_methods ("/node", l_node_handler, l_methods)
create l_node_handler.make (config)
create l_methods
l_methods.enable_get
l_methods.enable_post
l_methods.enable_put
l_methods.enable_delete
router.handle_with_request_methods ("/node/{id}", l_node_handler, l_methods)
end
configure_api_nodes
local
l_nodes_handler: NODES_HANDLER
l_methods: WSF_REQUEST_METHODS
do
create l_nodes_handler.make (config)
create l_methods
l_methods.enable_get
router.handle_with_request_methods ("/nodes", l_nodes_handler, l_methods)
end
configure_api_node_summary
local
l_report_handler: NODE_SUMMARY_HANDLER
l_methods: WSF_REQUEST_METHODS
do
create l_report_handler.make (config)
create l_methods
l_methods.enable_get
l_methods.enable_post
l_methods.enable_put
router.handle_with_request_methods ("/node/{id}/summary", l_report_handler, l_methods)
end
configure_api_node_title
local
l_report_handler: NODE_TITLE_HANDLER
l_methods: WSF_REQUEST_METHODS
do
create l_report_handler.make (config)
create l_methods
l_methods.enable_get
l_methods.enable_post
l_methods.enable_put
router.handle_with_request_methods ("/node/{id}/title", l_report_handler, l_methods)
end
configure_api_node_content
local
l_report_handler: NODE_CONTENT_HANDLER
l_methods: WSF_REQUEST_METHODS
do
create l_report_handler.make (config)
create l_methods
l_methods.enable_get
l_methods.enable_post
l_methods.enable_put
router.handle_with_request_methods ("/node/{id}/content", l_report_handler, l_methods)
end
end

View File

@@ -1,127 +0,0 @@
note
description: "Summary description for {CMS_API_SERVICE}."
date: "$Date$"
revision: "$Revision$"
class
CMS_API_SERVICE
inherit
SHARED_ERROR
REFACTORING_HELPER
create make
feature -- Initialize
make (a_storage: CMS_STORAGE)
-- Create the API service with an storege `a_storage'.
do
storage := a_storage
set_successful
ensure
storage_set: storage = a_storage
end
feature -- Access
login_valid (l_auth_login, l_auth_password: READABLE_STRING_32): BOOLEAN
local
l_security: SECURITY_PROVIDER
do
Result := storage.is_valid_credential (l_auth_login, l_auth_password)
end
feature -- Access: Node
nodes: LIST[CMS_NODE]
-- List of nodes.
do
fixme ("Implementation")
Result := storage.recent_nodes (0, 10)
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
fixme ("Check preconditions")
Result := storage.node (a_id)
end
feature -- Change: Node
new_node (a_node: CMS_NODE)
-- Add a new node
do
storage.save_node (a_node)
end
delete_node (a_id: INTEGER_64)
do
storage.delete_node (a_id)
end
update_node (a_id: like {CMS_USER}.id; a_node: CMS_NODE)
do
storage.update_node (a_id,a_node)
end
update_node_title (a_id: like {CMS_USER}.id; a_node_id: like {CMS_NODE}.id; a_title: READABLE_STRING_32)
do
fixme ("Check preconditions")
storage.update_node_title (a_id,a_node_id,a_title)
end
update_node_summary (a_id: like {CMS_USER}.id; a_node_id: like {CMS_NODE}.id; a_summary: READABLE_STRING_32)
do
fixme ("Check preconditions")
storage.update_node_summary (a_id,a_node_id, a_summary)
end
update_node_content (a_id: like {CMS_USER}.id; a_node_id: like {CMS_NODE}.id; a_content: READABLE_STRING_32)
do
fixme ("Check preconditions")
storage.update_node_content (a_id,a_node_id, a_content)
end
feature -- Access: User
user_by_name (a_username: READABLE_STRING_32): detachable CMS_USER
do
Result := storage.user_by_name (a_username)
end
feature -- Change User
new_user (a_user: CMS_USER)
-- Add a new user `a_user'.
do
if
attached a_user.password as l_password and then
attached a_user.email as l_email
then
storage.save_user (a_user)
else
fixme ("Add error")
end
end
feature {NONE} -- Implemenataion
storage: CMS_STORAGE
-- Persistence storage
end

View File

@@ -1,58 +0,0 @@
note
description: "Summary description for {CMS_REQUEST_UTIL}."
author: ""
date: "$Date$"
revision: "$Revision$"
deferred class
CMS_REQUEST_UTIL
inherit
REFACTORING_HELPER
feature -- User
current_user_name (req: WSF_REQUEST): detachable READABLE_STRING_32
-- Current user name or Void in case of Guest users.
note
EIS: "src=eiffel:?class=AUTHENTICATION_FILTER&feature=execute"
do
if attached {CMS_USER} current_user (req) as l_user then
Result := l_user.name
end
end
current_user (req: WSF_REQUEST): detachable CMS_USER
-- Current user or Void in case of Guest user.
note
EIS: "eiffel:?class=AUTHENTICATION_FILTER&feature=execute"
do
if attached {CMS_USER} req.execution_variable ("user") as l_user then
Result := l_user
end
end
feature -- Media Type
current_media_type (req: WSF_REQUEST): detachable READABLE_STRING_32
-- Current media type or Void if it's not acceptable.
do
if attached {STRING} req.execution_variable ("media_type") as l_type then
Result := l_type
end
end
feature -- Absolute Host
absolute_host (req: WSF_REQUEST; a_path:STRING): STRING
do
Result := req.absolute_script_url (a_path)
if Result.last_index_of ('/', Result.count) = Result.count then
Result.remove_tail (1)
end
end
end

View File

@@ -1,156 +0,0 @@
note
description: "[
This class implements the CMS service
It could be used to implement the main EWF service, or
even for a specific handler.
]"
class
CMS_SERVICE
inherit
WSF_ROUTED_SKELETON_SERVICE
undefine
requires_proxy
redefine
execute_default
end
WSF_FILTERED_SERVICE
WSF_FILTER
rename
execute as execute_filter
end
WSF_NO_PROXY_POLICY
WSF_URI_HELPER_FOR_ROUTED_SERVICE
WSF_URI_TEMPLATE_HELPER_FOR_ROUTED_SERVICE
REFACTORING_HELPER
SHARED_LOGGER
create
make
feature {NONE} -- Initialization
make (a_setup: CMS_SETUP)
do
setup := a_setup
configuration := a_setup.configuration
modules := a_setup.modules
initialize_users
initialize_auth_engine
initialize_mailer
initialize_router
initialize_modules
end
initialize_users
do
end
initialize_mailer
do
to_implement ("To Implement mailer")
end
setup_router
do
configure_api_root
end
initialize_modules
-- Intialize modules, import router definitions
-- from enabled modules.
do
log.write_debug (generator + ".initialize_modules")
across
modules as m
loop
if m.item.is_enabled then
router.import (m.item.router)
end
end
configure_api_file_handler
end
initialize_auth_engine
do
to_implement ("To Implement authentication engine")
end
configure_api_root
local
l_root_handler: CMS_ROOT_HANDLER
l_methods: WSF_REQUEST_METHODS
do
log.write_debug (generator + ".configure_api_root")
create l_root_handler.make (setup)
create l_methods
l_methods.enable_get
router.handle_with_request_methods ("/", l_root_handler, l_methods)
end
configure_api_file_handler
local
fhdl: WSF_FILE_SYSTEM_HANDLER
do
log.write_debug (generator + ".configure_api_file_handler")
create fhdl.make_hidden_with_path (setup.layout.www_path)
fhdl.disable_index
fhdl.set_not_found_handler (agent (ia_uri: READABLE_STRING_8; ia_req: WSF_REQUEST; ia_res: WSF_RESPONSE)
do
execute_default (ia_req, ia_res)
end)
router.handle_with_request_methods ("/", fhdl, router.methods_GET)
end
feature -- Access
setup: CMS_SETUP
-- CMS setup.
configuration: CMS_CONFIGURATION
-- CMS configuration.
-- | Maybe we can compute it (using `setup') instead of using memory.
modules: LIST [CMS_MODULE]
-- List of possible modules.
-- | Maybe we can compute it (using `setup') instead of using memory.
feature -- Logging
feature -- Notification
feature -- Execution
execute_default (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Default request handler if no other are relevant
local
do
fixme ("To Implement")
end
note
copyright: "2011-2014, Jocelyn Fiat, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -1,36 +0,0 @@
note
description: "Summary description for {CMS_HANDLER}."
author: ""
date: "$Date$"
revision: "$Revision$"
deferred class
CMS_HANDLER
inherit
CMS_REQUEST_UTIL
SHARED_LOGGER
REFACTORING_HELPER
feature {NONE} -- Initialization
make (a_setup: CMS_SETUP)
do
setup := a_setup
end
feature -- Setup
setup: CMS_SETUP
feature -- API Service
api_service: CMS_API_SERVICE
do
Result := setup.api_service
end
end

View File

@@ -1,62 +0,0 @@
note
description: "Summary description for {CMS_GENERIC_RESPONSE}."
date: "$Date$"
revision: "$Revision$"
class
CMS_GENERIC_RESPONSE
feature -- Responses
new_response_redirect (req: WSF_REQUEST; res: WSF_RESPONSE; a_location: READABLE_STRING_32)
-- Redirect to `a_location'
local
h: HTTP_HEADER
do
create h.make
h.put_content_type_text_html
h.put_current_date
h.put_location (a_location)
res.set_status_code ({HTTP_STATUS_CODE}.see_other)
res.put_header_text (h.string)
end
new_response_authenticate (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Handle authenticate.
local
h: HTTP_HEADER
do
create h.make
h.put_content_type_text_html
h.put_current_date
h.put_header_key_value ({HTTP_HEADER_NAMES}.header_www_authenticate, "Basic realm=%"CMS-User%"")
res.set_status_code ({HTTP_STATUS_CODE}.unauthorized)
res.put_header_text (h.string)
end
new_response_denied (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Handle access denied.
local
h: HTTP_HEADER
do
create h.make
h.put_content_type_text_html
h.put_current_date
res.set_status_code ({HTTP_STATUS_CODE}.unauthorized)
res.put_header_text (h.string)
end
new_response_unauthorized (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Handle not authorized.
local
h: HTTP_HEADER
output: STRING
do
create h.make
h.put_content_type_text_html
h.put_current_date
res.set_status_code ({HTTP_STATUS_CODE}.forbidden)
res.put_header_text (h.string)
end
end

View File

@@ -1,190 +0,0 @@
note
description: "Generic CMS Response, place to add HOOKS features as collaborators."
date: "$Date$"
revision: "$Revision$"
deferred class
CMS_RESPONSE
inherit
CMS_REQUEST_UTIL
REFACTORING_HELPER
feature {NONE} -- Initialization
make (req: WSF_REQUEST; res: WSF_RESPONSE; a_setup: like setup; a_template: like template)
do
status_code := {HTTP_STATUS_CODE}.ok
setup := a_setup
request := req
response := res
template := a_template
create header.make
initialize
end
initialize
do
get_theme
end
feature -- Access
request: WSF_REQUEST
response: WSF_RESPONSE
setup: CMS_SETUP
-- Current setup
status_code: INTEGER
header: WSF_HEADER
title: detachable READABLE_STRING_32
page_title: detachable READABLE_STRING_32
-- Page title
main_content: detachable STRING_8
template: READABLE_STRING_32
-- Current template.
feature -- Element change
set_title (t: like title)
do
title := t
set_page_title (t)
end
set_page_title (t: like page_title)
do
page_title := t
end
set_main_content (s: like main_content)
do
main_content := s
end
feature -- Theme
theme: CMS_THEME
-- Current theme
get_theme
local
l_info: CMS_THEME_INFORMATION
do
if attached setup.theme_information_location as fn then
create l_info.make (fn)
else
create l_info.make_default
end
if l_info.engine.is_case_insensitive_equal_general ("smarty") then
create {SMARTY_CMS_THEME} theme.make (setup, l_info, template)
else
create {DEFAULT_CMS_THEME} theme.make (setup, l_info)
end
end
feature -- Element Change
set_status_code (a_status: INTEGER)
-- Set `status_code' with `a_status'.
note
EIS: "src=eiffel:?class=HTTP_STATUS_CODE"
do
to_implement ("Feature to test if a_status is a valid status code!!!.")
status_code := a_status
ensure
status_code_set: status_code = a_status
end
feature -- Generation
prepare (page: CMS_HTML_PAGE)
do
common_prepare (page)
custom_prepare (page)
end
common_prepare (page: CMS_HTML_PAGE)
do
fixme ("Fix generacion common")
page.register_variable (request.absolute_script_url (""), "host")
page.register_variable (setup.is_web, "web")
page.register_variable (setup.is_html, "html")
if attached current_user_name (request) as l_user then
page.register_variable (l_user, "user")
end
end
custom_prepare (page: CMS_HTML_PAGE)
do
end
feature -- Custom Variables
variables: detachable STRING_TABLE[ANY]
-- Custom variables to feed the templates.
feature -- Element change: Add custom variables.
add_variable (a_element: ANY; a_key:READABLE_STRING_32)
local
l_variables: like variables
do
l_variables := variables
if l_variables = Void then
create l_variables.make (5)
variables := l_variables
end
l_variables.force (a_element, a_key)
end
feature -- Execution
execute
do
begin
process
terminate
end
feature {NONE} -- Execution
begin
do
end
process
deferred
end
frozen terminate
local
cms_page: CMS_HTML_PAGE
page: CMS_HTML_PAGE_RESPONSE
do
create cms_page.make
prepare (cms_page)
create page.make (theme.page_html (cms_page))
page.set_status_code (status_code)
response.send (page)
on_terminated
end
on_terminated
do
end
end

View File

@@ -1,37 +0,0 @@
note
description: "Summary description for {ERROR_500_CMS_RESPONSE}."
date: "$Date$"
revision: "$Revision$"
class
ERROR_500_CMS_RESPONSE
inherit
CMS_RESPONSE
redefine
custom_prepare
end
create
make
feature -- Generation
custom_prepare (page: CMS_HTML_PAGE)
do
page.register_variable (request.absolute_script_url (request.path_info), "request")
page.register_variable ("500", "code")
page.set_status_code (500)
end
feature -- Execution
process
-- Computed response message.
do
set_title ("Internal Server Error")
set_page_title (Void)
end
end

View File

@@ -1,37 +0,0 @@
note
description: "Summary description for {NODE_VIEW_CMS_RESPONSE}."
date: "$Date$"
revision: "$Revision$"
class
GENERIC_VIEW_CMS_RESPONSE
inherit
CMS_RESPONSE
redefine
custom_prepare
end
create
make
feature -- Generation
custom_prepare (page: CMS_HTML_PAGE)
do
if attached variables as l_variables then
across l_variables as c loop page.register_variable (c.item, c.key) end
end
end
feature -- Execution
process
-- Computed response message.
do
set_title ("CMS")
set_page_title (Void)
end
end

View File

@@ -1,48 +0,0 @@
note
description: "Summary description for {WSF_CMS_THEME}."
author: ""
date: "$Date$"
revision: "$Revision$"
deferred class
CMS_THEME
feature {NONE} -- Access
setup: CMS_SETUP
feature -- Access
name: STRING
deferred
end
regions: ARRAY [STRING]
deferred
end
page_template: CMS_TEMPLATE
deferred
end
feature -- Conversion
page_html (page: CMS_HTML_PAGE): STRING_8
-- Render `page' as html.
deferred
end
feature {NONE} -- Implementation
note
copyright: "2011-2014, Jocelyn Fiat, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -1,100 +0,0 @@
note
description: "Summary description for {CMS_HTML_TEMPLATE}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
DEFAULT_CMS_HTML_TEMPLATE
inherit
CMS_HTML_TEMPLATE
DEFAULT_CMS_TEMPLATE
create
make
feature {NONE} -- Initialization
make (t: DEFAULT_CMS_THEME)
do
theme := t
create variables.make (0)
end
variables: STRING_TABLE [detachable ANY]
feature -- Access
register (v: STRING_8; k: STRING_8)
do
variables.force (v, k)
end
theme: DEFAULT_CMS_THEME
prepare (page: CMS_HTML_PAGE)
do
variables.make (10)
across
page.variables as ic
loop
variables.force (ic.item, ic.key)
end
if attached page.title as l_title then
variables.force (l_title, "title")
variables.force (l_title, "head_title")
else
variables.force ("", "title")
variables.force ("", "head_title")
end
variables.force (page.language, "language")
variables.force (page.head_lines_to_string, "head_lines")
end
to_html (page: CMS_HTML_PAGE): STRING
do
-- Process html generation
create Result.make_from_string (template)
apply_template_engine (Result)
end
feature {NONE} -- Implementation
template: STRING
once
Result := "[
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="$language" lang="$language" version="XHTML+RDFa 1.0" dir="ltr">
<head>
$head
<title>$head_title</title>
$styles
$scripts
$head_lines
</head>
<body class="$body_classes" $body_attributes>
$page_top
$page
$page_bottom
</body>
</html>
]"
end
note
copyright: "2011-2014, Jocelyn Fiat, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -1,102 +0,0 @@
note
description: "Summary description for {CMS_PAGE_TEMPLATE}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
DEFAULT_CMS_PAGE_TEMPLATE
inherit
CMS_PAGE_TEMPLATE
DEFAULT_CMS_TEMPLATE
create
make
feature {NONE} -- Initialization
make (t: DEFAULT_CMS_THEME)
do
theme := t
create variables.make (0)
end
variables: STRING_TABLE [detachable ANY]
feature -- Access
theme: DEFAULT_CMS_THEME
prepare (page: CMS_HTML_PAGE)
do
variables.make (10)
across
page.variables as ic
loop
variables.force (ic.item, ic.key)
end
if attached page.title as l_title then
variables.force (l_title, "title")
else
variables.force ("", "title")
end
across
theme.regions as r
loop
variables.force (page.region (r.item), r.item)
end
end
to_html (page: CMS_HTML_PAGE): STRING
do
-- Process html generation
create Result.make_from_string (template)
apply_template_engine (Result)
end
feature -- Registration
register (v: STRING_8; k: STRING_8)
do
variables.force (v, k)
end
feature {NONE} -- Implementation
template: STRING
once
Result := "[
<div id="page-wrapper">
<div id="page">
<div id="header">
$header
</div>
<div id="main-wrapper">
<div id="main">
<div id="first_sidebar" class="sidebar $first_sidebar_css_class">$first_sidebar</div>
<div id="content" class="$content_css_class">$content</div>
<div id="second_sidebar" class="sidebar $second_sidebar_css_class">$second_sidebar</div>
</div>
</div>
<div id="footer">$footer</div>
</div>
</div>
]"
end
note
copyright: "2011-2014, Jocelyn Fiat, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -1,96 +0,0 @@
note
description: "Summary description for {CMS_THEME}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
DEFAULT_CMS_THEME
inherit
CMS_THEME
create
make
feature {NONE} -- Initialization
make (a_setup: like setup; a_info: like information)
do
setup := a_setup
information := a_info
end
information: CMS_THEME_INFORMATION
feature -- Access
name: STRING = "CMS"
regions: ARRAY [STRING]
once
Result := <<"header", "content", "footer", "first_sidebar", "second_sidebar">>
end
html_template: DEFAULT_CMS_HTML_TEMPLATE
local
tpl: like internal_html_template
do
tpl := internal_html_template
if tpl = Void then
create tpl.make (Current)
internal_html_template := tpl
end
Result := tpl
end
page_template: DEFAULT_CMS_PAGE_TEMPLATE
local
tpl: like internal_page_template
do
tpl := internal_page_template
if tpl = Void then
create tpl.make (Current)
internal_page_template := tpl
end
Result := tpl
end
feature -- Conversion
prepare (page: CMS_HTML_PAGE)
do
-- page.add_style (url ("/theme/style.css", Void), Void)
end
page_html (page: CMS_HTML_PAGE): STRING_8
local
l_content: STRING_8
do
prepare (page)
page_template.prepare (page)
l_content := page_template.to_html (page)
html_template.prepare (page)
html_template.register (l_content, "page")
Result := html_template.to_html (page)
end
feature {NONE} -- Internal
internal_page_template: detachable like page_template
internal_html_template: detachable like html_template
invariant
attached internal_page_template as inv_p implies inv_p.theme = Current
note
copyright: "2011-2014, Jocelyn Fiat, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

View File

@@ -1,104 +0,0 @@
note
description: "Summary description for {SMARTY_CMS_THEME}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
SMARTY_CMS_THEME
inherit
CMS_THEME
create
make
feature {NONE} -- Initialization
make (a_setup: like setup; a_info: like information; a_template: like template)
do
setup := a_setup
information := a_info
template := a_template
if attached a_info.item ("template_dir") as s then
templates_directory := a_setup.theme_location.extended (s)
else
templates_directory := a_setup.theme_location
end
ensure
setup_set: setup = a_setup
information_set: information = a_info
template_set: template = a_template
end
feature -- Access
name: STRING = "smarty-CMS"
template: STRING;
templates_directory: PATH
information: CMS_THEME_INFORMATION
regions: ARRAY [STRING]
local
i: INTEGER
utf: UTF_CONVERTER
once
if attached information.regions as tb and then not tb.is_empty then
i := 1
create Result.make_filled ("", i, i + tb.count - 1)
across
tb as ic
loop
Result.force (utf.utf_32_string_to_utf_8_string_8 (ic.key), i) -- NOTE: UTF-8 encoded !
i := i + 1
end
else
Result := <<"header", "content", "footer", "first_sidebar", "second_sidebar">>
end
end
page_template: SMARTY_CMS_PAGE_TEMPLATE
local
tpl: like internal_page_template
do
tpl := internal_page_template
if tpl = Void then
create tpl.make (template, Current)
internal_page_template := tpl
end
Result := tpl
end
feature -- Conversion
prepare (page: CMS_HTML_PAGE)
do
end
page_html (page: CMS_HTML_PAGE): STRING_8
do
prepare (page)
page_template.prepare (page)
Result := page_template.to_html (page)
end
feature {NONE} -- Internal
internal_page_template: detachable like page_template
invariant
attached internal_page_template as inv_p implies inv_p.theme = Current
note
copyright: "2011-2014, Jocelyn Fiat, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end

BIN
doc/img_diagram.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

396
doc/readme.md Normal file
View File

@@ -0,0 +1,396 @@
ROC CMS Documentation
=====================
[TOC]
## Overview
**ROC CMS** stands for "REST On CMS", however, until now, no particular focus was done on the REST API approach, and so far a more pragmatic approach dominated.
Part of the design is inspired by Drupal (blocks, hooks, Role-based access control, ...), and other parts related to Eiffel. Priorities, modules and related have been driven by concrete need, in order to fulfill the https://eiffel.org/ websites. Also a contribution (as student projects, or others) helped build various modules or functionality.
Currently, **ROC CMS** is a library or **framework** that provides components, tools and resources to build a CMS (Content Management System). It is not currently a CMS product, one can install and customize without any code.
Thus, it will be interesting for people willing to build a website using **Eiffel**. This will enable to reuse other Eiffel components, better integration with other Eiffel projects, and of course benefit from all the goodies of the Eiffel technologies (Eiffel language, DbC, re-usability, portability, IDE, debugger,...).
It depends on the **Eiffel Web Framework** (known as "Eiffel Web" or "EWF"), and thus can be executed as standalone, or CGI, libFCGI mode on Apache2 for instance, and on any Windows or Linux platform).
The main notions are:
- CMS Execution
- CMS APIs
- CMS Response
- CMS Modules
- CMS Hooks
- CMS Theme, blocks, links, ...
Those points will be described later in appropriated sections.
## Setup
The ROC CMS source is available either with the latest EiffelStudio release under the locations:
- $ISE_LIBRARY\unstable\library\web\cms
- or from github project https://github.com/EiffelWebFramework/ROC branch v0 for now.
```
git clone https://github.com/EiffelWebFramework/ROC -b v0
```
Note that if you use the source code from the github repository, you will need to use the latest release of EiffelStudio as it relieѕ on recent version of various libraries such as EWF, sqlite3, ....
And using the "master" branch, even the trunk version of EiffelStudio libraries. So for now, we encourage you to use the ROC CMS shipped with your EiffelStudio.
Once you have the source code, you should compile project <code>cms/example/demo/demo-safe.ecf</code> target "demo_standalone".
```
# from Command line
cd example
cd demo
ec -config demo-safe.ecf -c_compile -finalize
cp ./EIFGENs/demo_standalone/F_Code/demo.exe demo.exe
demo.exe
# or launch EiffelStudio, and open that project, compile and execute it inside the debugger for instance.
````
This demo includes all the official ROC CMS modules, files, and use libsqlite3 as default storage engine. So you should be able to execute it easily. The **standalone** target is configured to listen on port 9090 by default. (Mostly to avoid conflict on other app that my listen on port 80 or 8080).
In the directory <code>site</code> you will find all the expected files that should be in the root directory.
* config/ : it contains the various configuration files, especially the **cms.ini**.
* modules/ : files associated with each installed ROC CMS module.
* scripts/ : common scripts used mainly to initialize SQL databases.
* themes/ : folder containing the available ROC CMS themes.
* files/ : folder containing files available from the ROC CMS app.
* And also demo.ini that contains the settings for the web launcher, (in our case, the standalone Eiffel server), such as port_number.
Now that you know how to compile, execute, and see the related configuration files, let's describes the main notions of the ROC CMS, first from
* an admin point of view (dev using ROC CMS to build its site),
* and then from a developer point of view (in case you want to contribute to ROC CMS).
## Usage
### Main entries
As a CMS administrator, you will need to setup your CMS application (here the demo example). For this purpose, the main entry points are the CMS_EXECUTION interface, and then the <code>site/</code> files (configuration, themes, templates, ...).
### CMS initialization/Execution
The `CMS_EXECUTION` interface is deferred, and your CMS application needs to inherit from it and define `setup_storage`, `initial_cms_setup` and `setup_modules`. See for instance `DEMO_CMS_EXECUTION`.
So, the descendant of `CMS_EXECUTION` (`DEMO_CMS_EXECUTION` in the example), is creating the `CMS_SETUP`, declares the available **storage** builders (for persistency), and declares the available **modules**.
#### Persistence/Storage
Depending on the **configuration**, the CMS engine will instantiate and use a specific **CMS_STORAGE** (the default is based on `Eiffel sqlite3`, otherwise `EiffelStore+MySQL` and `EiffelStore+ODBC` are available). The storage solution is used to implement the persistence layer, and thus store and load CMS data to disk, or database.
The CMS provides, for now, storage based on
* EiffelStore + MySQL
* EiffelStore + ODBC (could be used for MySQL, sqlite, SQLserver, ...)
* Eiffel sqlite3 : that one is the default storage, since it is convenient for testing, but it is recommended to use EiffelStore+MySQL in production CMS site.
A typical implementation of <code>setup_storage</code> is:
```eiffel
setup_storage (a_setup: CMS_SETUP)
do
a_setup.storage_drivers.force (create {CMS_STORAGE_SQLITE3_BUILDER}.make, "sqlite3")
-- a_setup.storage_drivers.force (create {CMS_STORAGE_STORE_ODBC_BUILDER}.make, "odbc")
end
```
And the CMS decides which storage should be used. It depends on the application configuration. See the **configuration** section.
Those data could be user information (login, email, password, ...), custom values, logs, emails, path aliases, ... and any data modules may need to store (for instance node content, for the `node` module.)
#### Modules
The `setup_module` is used to declare available **modules** (instances of `CMS_MODULE` effective types).
The modular design provides a simple way to extend or alter the CMS functionalities/behaviors.
Most of the CMS features are implemented by modules, and each module relies on the core of the CMS core.
This **core** contains the `CMS_API`, `CMS_USER_API`, and various internal mechanisms such as mailer, logger, ...
Use `setup_module (a_setup: CMS_SETUP)` to customize the `CMS_SETUP` object created by `initial_cms_setup`.
For your convenience, ROC CMS provides a `CMS_DEFAULT_SETUP` that import configuration from `site/config/cms.ini`
So far, what you need to remember is `CMS_EXECUTION` class and descendants are used to set up the ROC CMS application, for storage, modules, and also how to load configuration.
Note that a module can have 3 states:
- not installed,
- installed and enabled,
- installed and disabled.
At first, to install the modules, open your browser at location `https://hostname:port/admin/install` and click the associated button.
(Note: for new module addition, you also need to install them, using the same link, in the future, there will be a proper module management interface, in the admin front-end.)
To enable or disable a module, you will need to use the `cms.ini` configuration file, please see the **configuration** section.
Existing modules:
- **admin**: basic administration pages, to manage modules, roles, permissions, users, caches, ... (note: it is still very basic, and need effort to improve it.)
- authentication modules based on **auth**:
- **basic_auth**: account signing using basic HTTP Authorization solution
- **oauth20**: sign using a thirdparty OAuth2.0 account (such as Google, Facebook, github, ...)
- **openid**: sign using an OpenID account.
- **node**: the base of node management, include **Page** content type.
- **blog**: extends the **node** module with a **blog** content type.
- **recent_changes**: compute recent changes of CMS (integration with **node** management, and any modules that implement the `CMS_RECENT_CHANGES_HOOK`).
- **feed_aggregator**: aggregate one or many feeds (rss, atom, ...), and provide associated pages or blocks.
- **google_search**: provides search facilities using the Google Custom Search API.
### Configuration
When `CMS_DEFAULT_SETUP` is used, the CMS configuration is loaded from `site/config/cms.ini`.
That file contains a few sections:
- **site**: to set the `name`, `email` and the name of the `theme`. (See "Themes" section pour information.)
- **layout**: the application layout (or environment) can precise the `root-dir`, `themes-dir`, `modules-dir`. If not defined, the values are computed from Current working directory.
- **mailer**: the CMS can send email notification for various reasons, such as new users, or reset password functionalities, ... In this section, you can use
- `smtp` settings to precise an SMTP server (+ port),
- or `sendmail` to use an external script using the sendmail usage,
- or just an `output` file such as @stderr, or a path to a file on disk.
- **modules**: used to enable or disable modules.
- `*=on` -> modules are enabled by default
- `*=off` -> modules are disabled by default
- Note the default value is `on`
- For each module, this can be overwritten with `module_name=on|off`
- **blocks**: settings for blocks (See Themes, Blocks sections for more information on the block). A few parameters are available to customize blocks. The general form is `block-name.param=value` (note that "foo.bar" is a value block name.)
- `block-name.region`: assign the block `block-name` to a specific region. A block can be assigned to **only one region**.
- `block-name.title`: used to overwrite the block title (with <none> , the title is hidden).
- `block-name.weight`: used to order blocks in the same region (blocks with lower weight goes first).
- `block-name.expiration`: used to provide a basic cache system based on expiration. The value is a number of seconds before the cache expires (-1: never expires, 0: never cache, n: cache expires after `n` seconds).
- `block-name.condition`, or `block-name.conditions[]`: include `block-name` only under specific condition(s). The condition can be
- `is_front`: which is True only for the front page, usually at url "/"
- `path:foo/bar`, `path:foo/*/bar`: True only for CMS location matching the patterns after "path:"
- `<none>`: related block is disabled.
- *note: There can be multiple conditions processed as any of the conditions (i.e: "or").*
- `block-name.options[varname]: pass a table of options `varname => value` to the related block. This can be used to pass parameters for block builder (for instance, recent_changes modules accept parameters "size" to know how many changes should be included.)
- To be able to include a block content into multiple region, it is possible to use aliases feature. For instance `&aliases[new_block]=block-name`, in this case, a `new_block` is declared, and it has same content as `block-name`, on this alias, the parameters `region, condition(s), title, weight` are supported, but not `options[]`.
- **admin**: various admin related settings such as
- `installation_access` which accepts 3 values: "all", "none" or "permission", to precise who has access to the modules installation page; either "all" for anyone, "none" to disable installation of new modules, or "permission" to use the CMS permissions solution to determine if the current user can install a new module.
Then, the configuration `cms.ini` can also define other parameters, and sections, that may be used by specific modules.
Note it is also possible to include another ini file with instruction `@include=path-to-file.ini`.
Check the `example/demo/site/cms.ini` for example.
### User management
The CMS core includes the notion of user, via interface `CMS_USER`, which has an id, a name, a password, ... and profile. Without any module, the CMS does not include any mean to authenticate, but still the CMS has the support for user management, and permissions system for current user. To be able to sign into the CMS, the site should include the module `auth`, and one or many of:
- `basic_auth`: authentication using the HTTP Authorization header.
- `oauth20`: being able to sign with an OAuth2.0 account (such as Google, Facebook, ...)
- `OpenID`: being able to sign with an OpenID account.
Whatever authentication solution is used, when a user is signed-in, there is an instance of `CMS_USER` representing the associated CMS user account.
There is a predefined user `admin` who is the administrator of the CMS, and by definition, this **admin** has all the permissions. It is initialized by default with username `admin` and password `istrator#`.
The access control is role-based permissions system. This means, a user can have one or many *roles*, and each *role* includes a list of *permissions*.
There are two built-in roles:
- **anonymous**: when no user is signed in (typically anonymous visitors).
- **authenticated**: when a user is signed in the CMS.
With those 2 built-ins roles, and any custom role the admin will create, it is possible to give specific permissions, to a group of users.
The CMS core defines a few permissions, and each module can also define their own permissions, for instance: "view any page", "create page", "edit page", "delete page", "clear cache", "install modules", ... (when the administrator is signed-in, go to url `/admin/role/1/edit` to see all the available permissions).
### Modules
A module is the way to extend the CMS engine.
First via the inherited `CMS_MODULE` interface that enables a module to:
- have a custom `install` and `uninstall` procedure by redefining the related routines.
- add its **routes** via `setup_router`. (i.e associated url or template of url with a specific request handler).
- register itself to hooks via `register_hooks`.
- declare new permissions by redefining `permissions`.
- provide a specific module api by redefining `module_api`.
- add its **filters** by redefining `filters`.
Using the `hooks` system, a module can be deeply integrated with the CMS engine, and even alter behaviors (for instance, add link, add css, javascript, ...). See related developer documentation on hooks.
It is simple to create your own modules (check the developer documentation).
The ROC CMS library provides a few modules for now, for instance: basic_auth, oauth20, openid, node, blog, feed_aggregator, recent_changes, google_search, ... and others (the list keeps growing...).
**Reminder**: to include a module to your CMS site, you need to
- include the associated .ecf file in your CMS site .ecf file.
- and also declare them in your descendant of CMS_EXECUTION.
- copy the eventual resources, configuration, ... files in the corresponding `site`.
Note: a tool **roc** is under development to ease such operations, for now it only copies needed files from module to site location. In the future, it should also update .ecf files, associated CMS_EXECUTION effective class.
### Themes
When talking about CMS, a major topic is how a request is rendered in a web browser. Here comes the notion of **theme** which is a collection of templates, accepting various values as input (including the content of the blocks), and renders as an html5 page. It also includes various assets such as css, javascript, icons, images, ...
The ROC CMS theming is inspired by Drupal, with the notion of **region** and **block**.
Note: for now, there is no simple "theme" module or similar, and the common way to start your CMS site is to copy an existing project such as the one available with the demo example (i.e: copying the source code, but also the `site` folder).
Currently the default theme of the demo example `SMARTY_CMS_THEME` is based on Eiffel **smarty** template library (Check [smarty doc](https://svn.eiffel.com/eiffelstudio/trunk/Src/contrib/library/text/template/smarty/README.md) for syntax and functionalities).
The layout of a CMS web page has predefined area called **regions**. The Eiffel CMS uses the same default regions as Drupal, so let's see them in the following image.
```
+----------------------------------------------------------+
| Page_top |
+----------------------------------------------------------+
| Header |
+---------------+-------------------------+----------------+
| | Highlighted | |
| Sidebar_first +-------------------------+ Sidebar_second |
| | Help | |
| +-------------------------+ |
| | | |
| | Content | |
| | | |
+---------------+-------------------------+----------------+
| Footer |
+----------------------------------------------------------+
| Page_bottom |
+----------------------------------------------------------+
```
The regions available for a theme, are defined in a configuration file `theme.info` located in the theme directory. For example:
```
name=default_theme
engine=smarty
version=0.1
regions[page_top] = Top
regions[header] = Header
regions[content] = Content
regions[highlighted] = Highlighted
regions[help] = Help
regions[footer] = Footer
regions[sidebar_first] = first sidebar
regions[sidebar_second] = second sidebar
regions[page_bottom] = Bottom
```
Note: the value for each region is the human readable region name.
Note the regions may be disposed with other layout (two sidebars on the left, or right, ... and so on), responsive design or not, and so on. But on the CMS side, a *block* can be inserted into a *region*, and depending if the region is included in the theme, the related block content will be displayed or not.
To sort *block* inside a region, the CMS is using the `weight` property (that can be set via code, and/or overridden via configuration, i.e: `cms.ini`).
This is how a site can support many themes, using the region as content holders, and theme for the layout and style.
Internally the block contents are stored in the values associated with each region.
The theme also has access to specific `values` such as
- `site_url`: the absolute url of the CMS website.
- `host`: the host name.
- `is_https`: True if the connection is using https://
- `user`: contains the username of the signed user, if any.
- `site_title`: site title.
- `page_title`: per page title.
- and also `page: CMS_HTML_PAGE` which represents the CMS page to render with the theme.
- `page` provides values via expression, such as `$page.type`, `$page.is_front`, `$page.is_https`, `$page.title`, ...
- and also a smart expression for region via `$page.region_xyz` for region `xyz` if any, ... (note the region are also available with expression like `$region_xyz` or `$page.region_xyz` ...)
==Note for developers: internally, the deferred class `CMS_RESPONSE` provides an abstraction to render the response for the request using the **theme**, in fact, the theme is controlled by the CMS_RESPONSE implementation (to set value, build expected theme, and finally render as html).==
### Blocks
As previously said, a region holds smaller piece of content called blocks.
Blocks hold chunks of content, like the user login form, navigation menu, information for the footer, or anything provided by each module.
For instance the `feed_aggregator` module provides a block to display the latest elements of a aggregated feed.
Currently there are different kind of `CMS_BLOCK`:
- `CMS_CONTENT_BLOCK`: it holds a simple text to render as it is on the page.
- `CMS_MENU_BLOCK`: it holds a `CMS_MENU` as a collection of `CMS_LINK` generally used to hold a menu, or set of links such as navigation or management menus.
- `CMS_SMARTY_TEMPLATE_BLOCK`: it holds a simple text to render as it is in the page.
Internally, there are two other kinds of block:
- `CMS_ALIAS_BLOCK`: being the alias of another block, but with specific properties.
- `CMS_CACHE_BLOCK`: there is a simple cache solution for blocks, based on expiration. See the configuration section to know how to define the expiration for a block.
For now, creating a block is only possible via block, an evolution of ROC CMS should allow the administrator to add new block without coding.
### Persistence
The persistence or storage layer is used by the CMS to store custom values, path aliases, logs, emails, user information, but it is also used by module (unless a module wants to use its own persistence solution, disk, cloud, ...).
Currently, there are only SQL based implementations of that `CMS_STORAGE`, but nothing prevents to implement it with other solutions (plain text file, NoSQL db, ...).
The current implementation are using either:
- EiffelStore + MySQL: recommended for production, however Eiffel MySQL requires to configure your environment by setting, for instance MYSQL variable on Windows, and MYSQLINC on Linux.
- EiffelStore + ODBC: via ODBC, there is a large range of available database (MySQL, SQLite, SQLserver, ...), but it requires to set up your environment (for instance install sqliteODBC driver to use SQLite database).
- Eiffel sqlite3 wrapper: it is very convenient for development, but maybe not recommended for production websites. It does not require any environment setup, so this is a simple solution to build tests for instance.
In practice, how to use a storage or another?
The project needs to include the expected storage, the following instructions explains how to include sqlite3, EiffelStore+ODBC and EiffelStore+MYSQL storage.
1. First the associated .ecf file need to be included in your project file (.ecf)
For instance
```xml
<library name="persistence_sqlite3" location="$ISE_LIBRARY\unstable\library\web\cms\library\persistence\sqlite3\sqlite3-safe.ecf"/>
<library name="persistence_store_odbc" location="$ISE_LIBRARY\unstable\library\web\cms\library\persistence\store_odbc\store_odbc-safe.ecf"/>
<library name="persistence_store_mysql" location="$ISE_LIBRARY\unstable\library\web\cms\library\persistence\store_mysql\store_mysql-safe.ecf"/>
```
2. Then in the descendant of `CMS_EXECUTION`, in the demo `DEMO_CMS_EXECUTION`, see the code of `setup_storage`:
```eiffel
setup_storage (a_setup: CMS_SETUP)
do
a_setup.storage_drivers.force (create {CMS_STORAGE_SQLITE3_BUILDER}.make, "sqlite3")
a_setup.storage_drivers.force (create {CMS_STORAGE_STORE_MYSQL_BUILDER}.make, "mysql")
a_setup.storage_drivers.force (create {CMS_STORAGE_STORE_ODBC_BUILDER}.make, "odbc")
end
```
3. And finally, in the configuration file `site/config/demo.json` (in fact, the executable name + ".json"), define the driver and environment of the datasource. For instance the following code defines **sqlite3** as default CMS storage, and environment *sqlite3* that defines the path of SQLite database as "site/database.sqlite3". Note the way to declare sqlite with ODBC, mysql with ODBC, or mysql directly with EiffelStore.
```json
{
"database": {
"datasource": {
"driver": "sqlite3",
"environment": "sqlite3",
},
"environments": {
"sqlite3": {
"connection_string":"Database=./site/database.sqlite3;"
},
"odbc-sqlite": {
"connection_string":"Driver=SQLite3 ODBC Driver;Database=./site/database.sqlite;LongNames=0;Timeout=1000;NoTXN=0;SyncPragma=NORMAL;StepAPI=0;"
},
"odbc-mysql": {
"connection_string":"Driver=mysql ODBC Driver;Server=localhost;Port=3306;Database=roc;Uid=roc;Pwd=roc;"
},
"mysql": {
"connection_string":"Driver=mysql;Server=localhost;Port=3306;Database=roc;Uid=roc;Pwd=roc;"
}
}
}
}
```
To use EiffelStore+MySQL, just change the "driver" to be "mysql" and "environment" to "mysql". The connection string for server database defines the credentials with "Uid" and "Pwd".
### How to run the CMS site?
As any Eiffel Web application (EWF), it can be executed as
- **standalone**: using Eiffel standalone httpd server included in the "standalone" connector, and then no setup is needed.
- **CGI** or **libFCGI** server: using, for instance, Apache2. Please refer to the Eiffel Web Framework documentation.
### Conclusion
At this point, you know enough to build and administrate a ROC CMS site.
However, for a real site, it is likely that you will need to build your own modules, you will learn how doing that in the Developer Documentation.
***
## Developper Documentation
This diagram shows the main interfaces, they will be described in this documentation, but for now, it introduces those class names.
![Diagram](img_diagram.png)
### CMS APIs
An instance of CMS_API is available either via argument, or via attribute / function of various CMS components.
It provides routine specific to the ROC CMS engine (access to setup, modules, logs, custom values, ...).
### CMS Hooks
Hooks is a mechanism which provides a way for modules to interact with each other and extending blocks of the current CMS.
- [CMS_HOOK](../library/src/hooks/cms_hook.e): deferred class CMS_HOOK is a marker interface for CMS Hook
- [CMS_HOOK_AUTO_REGISTER](../library/src/hooks/cms_hook_auto_register.e): when inheriting from this deferred class, the declared hooks are automatically registered (note only the CMS core hooks are supported, as opposed to hook a module may propose). Otherwise, each descendant has to register itself to the associated hook manager.
- [CMS_HOOK_BLOCK](../library/src/hooks/cms_hook_block.e): it provides a way to declare and build blocks.
- [CMS_HOOK_FORM_ALTER](../library/src/hooks/cms_hook_form_alter.e): it provides a way to alter a web form `CMS_FORM`.
- [CMS_HOOK_MENU_ALTER](../library/src/hooks/cms_hook_menu_alter.e): it provides a way to alter a menu, and thus add or remove a link. This is how a module can add a link into a specific `CMS_MENU`.
- [CMS_HOOK_MENU_SYSTEM_ALTER](../library/src/hooks/cms_hook_menu_system_alter.e): similar to CMS_HOOK_MENU_ALTER, but on built-in menu, such as management, navigation menus, and other.
- [CMS_HOOK_VALUE_TABLE_ALTER](../library/src/hooks/cms_hook_value_table_alter.e): it provides a way to alter the values table for a response (i.e: inserting custom values, or even override existing values).
- [CMS_HOOK_EXPORT](../library/src/hooks/cms_hook_export.e): it provides a simple export solution for each module. Typically used to archive data associated with a module, for instance for backup purpose. In the future, a `CMS_HOOK_IMPORT` should also be available, and it would allow importing data exported by `CMS_HOOK_EXPORT`.
- and for more hooks ... please check descendants of `CMS_HOOK`.
### Custom Module
How to build a new module?
A module is usually developed as an Eiffel library, and provide one or many implementations of `CMS_MODULE`.
It has to set or implement:
- **name**: a unique name identifying the module
- **description**: a human text to describe the purpose of the module, it will mainly be used by the administration front-end.
- **package**: put the current module into a package, mainly for admin front-end.
- **version**: version information
- **dependencies**: defines dependencies on other modules.
- **permissions**: defines permissions used by the modules (mainly for admin front-end)
- **setup_router**: associate routes with request handlers (declare various url or url template and associated request handler).
- **filters**: similar to routers setup, but for WSF Filters (See EWF documentation for more details).
- **register_hooks**: register current module with various hooks if needed.
A module can also redefine `install` and `uninstall`. This could be used during installation to create new database tables, or anything needed by the module, or clean similar resources when being uninstalled.
In addition, a module can also implement `module_api: detachable CMS_MODULE_API` in order to be integrated easily with other modules (see for instance the CMS_NODE_API defined in **node** module).
Please have a look at the [tutorial](tutorial.md) page.
## References
For the interface references, please have a look at the [ROC CMS source code](https://github.com/EiffelWebFramework/ROC).
***
*(last modified: Nov/17/2015 by Jocelyn.)*

121
doc/tutorial.md Normal file
View File

@@ -0,0 +1,121 @@
CMS Tutorial
============
[Work in progress]
##### Table of Contents
[Getting Started](#init)
[Building your module](#module)
[Lifecycle](#cycle)
<a name="init"/>
Getting Started
-------------
<a name="module"/>
Building your own module
------------------------
A [Module](/doc/concepts.md#modules) as we already describe it, enable us to add functionallity based on your needs.
Here we will describe the basics steps to write your own modules.
* The first thing to do is inherit from the class [CMS_MODULE] () and redefine the register_hooks (2) feature.
* Implement (via inheritance) the needed [Hooks] (/doc/concepts.md#hooks).
* Define the module API through route definition. (1)
* Define the list of block to be handle by the current module (3).
* Render the block (4) (could be defined in Eiffel itself or using a template file (smarty)).
* API implementation (5).
```
class MY_NEW_MODULE
inherit
CMS_MODULE
redefine
register_hooks
end
CMS_HOOK_BLOCK
CMS_HOOK_MENU_SYSTEM_ALTER
create
make
feature {NONE} -- Initialization
make
-- Create current module
do
name := "new module"
version := "1.0"
description := "Eiffel new module"
package := "example"
end
feature -- Access: router
router (a_api: CMS_API): WSF_ROUTER
-- (1) Node router.
do
create Result.make (1)
Result.handle_with_request_methods ("/demo", create {WSF_URI_AGENT_HANDLER}.make (agent handle_demo (a_api, ?, ?)), Result.methods_head_get)
end
feature -- Hooks
register_hooks (a_response: CMS_RESPONSE)
do
-- (2)
a_response.subscribe_to_menu_system_alter_hook (Current)
a_response.subscribe_to_block_hook (Current)
end
block_list: ITERABLE [like {CMS_BLOCK}.name]
do
-- (3) List of block names, managed by current object.
end
get_block_view (a_block_id: READABLE_STRING_8; a_response: CMS_RESPONSE)
do
-- (4) Get block object identified by `a_block_id' and associate with `a_response'.
end
menu_system_alter (a_menu_system: CMS_MENU_SYSTEM; a_response: CMS_RESPONSE)
local
lnk: CMS_LOCAL_LINK
do
create lnk.make ("Demo", "/demo/")
a_menu_system.primary_menu.extend (lnk)
end
feature -- Handler
handle_demo (a_api: CMS_API; req: WSF_REQUEST; res: WSF_RESPONSE;)
local
r: NOT_IMPLEMENTED_ERROR_CMS_RESPONSE
do
-- (5)
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")
r.execute
end
end
```
<a name="cycle"/>
Lifecycle
---------

View File

@@ -1,49 +0,0 @@
CMS Hypermedia API and Adaptive Web Design
============================================
A content management system is not a simple domain.
This example shows how to build a basic Hypermedia API for a CMS using HTML5 and progressive enhacement.
The idea is based on an existing [Eiffel CMS] (https://github.com/EiffelWebFramework/cms), the goal is learn the domain and create a new modular CMS.
Persistence
============
The current solution uses MySQL and only handle users and nodes concept.
Authentication/Authorization
============================
Basic Auth.
API features
============
There is no session.
The root uri:
shows Navigation and the possiblity to add a New Node (only for loggedin users).
shows a predefined number of nodes the `n' most recent nodes.
Guest users will be able to list all the nodes and view a particular node.
Logged in users.
Logged users are able to
Add a new node
Edit an existing node
Edit a node title
Edit a node summary
Edit a node content
Delete a node
Server Modes
============
api: HTML5 API
html: api with progresive enhacements css and js, server side rendering.
web: api with progresive enhacements css and js and Ajax calls.
References
1: http://codeartisan.blogspot.se/2012/07/using-html-as-media-type-for-your-api.html
2: https://github.com/gustafnk/combining-html-hypermedia-apis-and-adaptive-web-design

View File

@@ -1,24 +0,0 @@
note
description: "[
Effective class for APPLICATION_LAUNCHER_I
You can put modification in this class
]"
date: "$Date: 2014-08-08 16:02:11 -0300 (vi., 08 ago. 2014) $"
revision: "$Revision: 95593 $"
class
APPLICATION_LAUNCHER
inherit
APPLICATION_LAUNCHER_I
feature -- Custom
is_console_output_supported: BOOLEAN
do
Result := False
end
end

View File

@@ -1,102 +0,0 @@
note
description: "[
Specific application launcher
DO NOT EDIT THIS CLASS
you can customize APPLICATION_LAUNCHER
]"
date: "$Date: 2014-08-08 16:02:11 -0300 (vi., 08 ago. 2014) $"
revision: "$Revision: 95593 $"
deferred class
APPLICATION_LAUNCHER_I
inherit
SHARED_EXECUTION_ENVIRONMENT
feature -- Execution
launch (a_service: WSF_SERVICE; opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
local
-- nature: like launcher_nature
do
-- nature := launcher_nature
-- if nature = Void or else nature = nature_nino then
-- launch_nino (a_service, opts)
-- elseif nature = nature_cgi then
-- launch_cgi (a_service, opts)
-- elseif nature = nature_libfcgi then
launch_libfcgi (a_service, opts)
-- else
-- -- bye bye
-- (create {EXCEPTIONS}).die (-1)
-- end
end
feature {NONE} -- Access
launcher_nature: detachable READABLE_STRING_8
-- Initialize the launcher nature
-- either cgi, libfcgi, or nino.
--| We could extend with more connector if needed.
--| and we could use WSF_DEFAULT_SERVICE_LAUNCHER to configure this at compilation time.
local
p: PATH
ext: detachable READABLE_STRING_32
do
create p.make_from_string (execution_environment.arguments.command_name)
if attached p.entry as l_entry then
ext := l_entry.extension
end
if ext /= Void then
if ext.same_string (nature_nino) then
Result := nature_nino
end
if ext.same_string (nature_cgi) then
Result := nature_cgi
end
if ext.same_string (nature_libfcgi) or else ext.same_string ("fcgi") then
Result := nature_libfcgi
end
end
end
feature {NONE} -- nino
nature_nino: STRING = "nino"
launch_nino (a_service: WSF_SERVICE; opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
local
launcher: WSF_NINO_SERVICE_LAUNCHER
do
create launcher.make_and_launch (a_service, opts)
end
feature {NONE} -- cgi
nature_cgi: STRING = "cgi"
launch_cgi (a_service: WSF_SERVICE; opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
local
launcher: WSF_CGI_SERVICE_LAUNCHER
do
create launcher.make_and_launch (a_service, opts)
end
feature {NONE} -- libfcgi
nature_libfcgi: STRING = "libfcgi"
launch_libfcgi (a_service: WSF_SERVICE; opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
local
launcher: WSF_LIBFCGI_SERVICE_LAUNCHER
do
create launcher.make_and_launch (a_service, opts)
end
end

View File

@@ -1,54 +0,0 @@
note
description: "[
Effective class for APPLICATION_LAUNCHER_I
You can put modification in this class
]"
date: "$Date: 2014-08-08 16:02:11 -0300 (vi., 08 ago. 2014) $"
revision: "$Revision: 95593 $"
class
APPLICATION_LAUNCHER
inherit
APPLICATION_LAUNCHER_I
SHARED_EXECUTION_ENVIRONMENT
feature -- Status Report
is_console_output_supported: BOOLEAN
do
Result := launcher_nature = nature_nino
end
feature {NONE} -- Initialization
launcher_nature: detachable READABLE_STRING_8
-- Initialize the launcher nature
-- either cgi, libfcgi, or nino.
--| We could extend with more connector if needed.
--| and we could use WSF_DEFAULT_SERVICE_LAUNCHER to configure this at compilation time.
local
p: PATH
ext: detachable READABLE_STRING_32
do
create p.make_from_string (execution_environment.arguments.command_name)
if attached p.entry as l_entry then
ext := l_entry.extension
end
if ext /= Void then
if ext.same_string (nature_nino) then
Result := nature_nino
end
end
end
feature {NONE} -- nino
nature_nino: STRING = "nino"
end

View File

@@ -1,26 +0,0 @@
note
description: "[
Specific application launcher
DO NOT EDIT THIS CLASS
you can customize APPLICATION_LAUNCHER
]"
date: "$Date: 2014-08-08 16:02:11 -0300 (vi., 08 ago. 2014) $"
revision: "$Revision: 95593 $"
deferred class
APPLICATION_LAUNCHER_I
feature -- Execution
launch (a_service: WSF_SERVICE; opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
local
launcher: WSF_SERVICE_LAUNCHER
do
create {WSF_DEFAULT_SERVICE_LAUNCHER} launcher.make_and_launch (a_service, opts)
end
end

View File

@@ -1,2 +0,0 @@
port=8088
#verbose=true

View File

@@ -1,82 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-13-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-13-0 http://www.eiffel.com/developers/xml/configuration-1-13-0.xsd" name="api" uuid="8B2873E9-8E2A-4490-8B6C-1122B579FD1D" library_target="api">
<target name="common" abstract="true">
<file_rule>
<exclude>/EIFGENs$</exclude>
<exclude>/CVS$</exclude>
<exclude>/.svn$</exclude>
</file_rule>
<option warning="true" full_class_checking="false" is_attached_by_default="true" void_safety="all" syntax="transitional">
<debug name="esa" enabled="true"/>
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
</option>
<setting name="console_application" value="true"/>
<setting name="exception_trace" value="true"/>
<setting name="concurrency" value="thread"/>
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<library name="conneg" location="$ISE_LIBRARY\contrib\library\network\protocol\content_negotiation\conneg-safe.ecf"/>
<library name="crypto" location="$ISE_LIBRARY\unstable\library\text\encryption\crypto\crypto-safe.ecf"/>
<library name="persistence_mysql" location="..\..\persistence\implementation\mysql\persistence_mysql.ecf" readonly="false"/>
<library name="encoder" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\text\encoder\encoder-safe.ecf"/>
<library name="http" location="$ISE_LIBRARY\contrib\library\network\protocol\http\http-safe.ecf"/>
<library name="http_authorization" location="$ISE_LIBRARY\contrib\library\network\authentication\http_authorization\http_authorization-safe.ecf" readonly="false"/>
<library name="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json-safe.ecf" readonly="false"/>
<library name="layout" location="..\..\layout\layout.ecf"/>
<library name="logging" location="$ISE_LIBRARY\library\runtime\logging\logging-safe.ecf"/>
<library name="net" location="$ISE_LIBRARY\library\net\net-safe.ecf"/>
<library name="process" location="$ISE_LIBRARY\library\process\process-safe.ecf"/>
<library name="smarty" location="$ISE_LIBRARY\contrib\library\text\template\smarty\smarty-safe.ecf" readonly="false"/>
<library name="wsf" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf-safe.ecf"/>
<library name="wsf_extension" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf_extension-safe.ecf" readonly="false"/>
</target>
<target name="api_any" extends="common">
<root class="ROC_SERVER" feature="make_and_launch"/>
<library name="cgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\connector\cgi-safe.ecf"/>
<library name="libfcgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\connector\libfcgi-safe.ecf"/>
<library name="nino" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\connector\nino-safe.ecf"/>
<cluster name="launcher" location=".\launcher\any\" recursive="true"/>
<cluster name="src" location=".\src\" recursive="true"/>
</target>
<target name="api_nino" extends="common">
<root class="ROC_SERVER" feature="make_and_launch"/>
<library name="default_nino" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\default\nino-safe.ecf"/>
<cluster name="launcher" location=".\launcher\default\" recursive="true"/>
<cluster name="src" location=".\src\" recursive="true"/>
</target>
<target name="api_cgi" extends="common">
<root class="ROC_SERVER" feature="make_and_launch"/>
<library name="default_cgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\default\cgi-safe.ecf"/>
<cluster name="launcher" location=".\launcher\default\" recursive="true"/>
<cluster name="src" location=".\src\" recursive="true"/>
</target>
<target name="api_libfcgi" extends="common">
<root class="ROC_SERVER" feature="make_and_launch"/>
<library name="cgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\connector\cgi-safe.ecf"/>
<library name="default_libfcgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\default\libfcgi-safe.ecf"/>
<library name="libfcgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\connector\libfcgi-safe.ecf"/>
<library name="nino" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\connector\nino-safe.ecf" readonly="false"/>
<library name="wgi_nino" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\ewsgi\connectors\nino\nino-safe.ecf"/>
<cluster name="launcher" location=".\launcher\any\" recursive="true"/>
<cluster name="src" location=".\src\" recursive="true"/>
</target>
<!-- <target name="api_test" extends="common">
<root class="APPLICATION_TEST" feature="make"/>
<library name="default_nino" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\default\nino-safe.ecf"/>
<library name="ewsgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\ewsgi\ewsgi-safe.ecf" readonly="false">
<option>
<assertions precondition="true" postcondition="true" check="true" supplier_precondition="true"/>
</option>
</library>
<library name="http_client" location="$ISE_LIBRARY\contrib\library\network\http_client\http_client-safe.ecf"/>
<library name="testing" location="$ISE_LIBRARY\library\testing\testing-safe.ecf"/>
<library name="thread" location="$ISE_LIBRARY\library\thread\thread-safe.ecf"/>
<library name="wgi_nino" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\ewsgi\connectors\nino\nino-safe.ecf"/>
<cluster name="launcher" location=".\launcher\default\" recursive="true"/>
<cluster name="src" location="src\" recursive="true"/>
<cluster name="test" location="test\" recursive="true"/>
</target>
-->
<target name="api" extends="api_nino">
</target>
</system>

View File

@@ -1,32 +0,0 @@
{
"database": {
"datasource": {
"driver": "MySQL",
"environment": "development"
},
"environments": {
"test": {
"connection_string":"Server=localhost;Port=3306;Database=cms_dev;Uid=root;Pwd=;"
},
"development": {
"connection_string":"Server=localhost;Port=3306;Database=cms_dev;Uid=root;Pwd=;"
},
"production": {
"connection_string":""
}
}
},
"smtp": {
"server": "localhost"
},
"logger": {
"level":"debug",
"backup_count":"4"
},
"server": {
"mode":"html"
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,357 +0,0 @@
/*
* Base structure
*/
/* Move down content because we have a fixed navbar that is 36px tall on small screen */
body {
padding-top: 40px;
}
/* On large screen, we give it more space and the navbar is 30px tall. */
@media (min-width: 768px) {
body {
padding-top: 45px;
}
}
/*
* Global add-ons
*/
h1 {
margin-top: initial;
margin-bottom: 5px;
}
h2.sub-header{
margin-top: 1px;
margin-bottom: 1px;
border-bottom: 1px solid #eee;
}
.container .jumbotron {
padding: 10px;
text-align: center;
}
/*
* Sidebar
*/
/* Hide for mobile, show later */
.sidebar {
display: none;
}
@media (min-width: 768px) {
.sidebar {
position: fixed;
top: 0;
left: 0;
bottom: 0;
z-index: 1000;
display: block;
padding: 70px 20px 20px;
background-color: #f5f5f5;
border-right: 1px solid #eee;
}
}
/* Sidebar navigation */
.nav-sidebar {
margin-left: -20px;
margin-right: -21px; /* 20px padding + 1px border */
margin-bottom: 20px;
}
.nav-sidebar > li > a {
padding-left: 20px;
padding-right: 20px;
}
.nav-sidebar > .active > a {
color: #fff;
background-color: #428bca;
}
/*
* Main content
*/
.main {
padding: 3px;
}
@media (min-width: 768px) {
.main {
padding-left: 15px;
padding-right: 15px;
}
}
.main .page-header {
margin-top: 0;
}
/*
* Placeholder dashboard ideas
*/
.placeholders {
margin-bottom: 30px;
text-align: center;
}
.placeholders h4 {
margin-bottom: 0;
}
.placeholder {
margin-bottom: 20px;
}
.placeholder img {
border-radius: 50%;
}
.navbar-default {
background-color:#194573;
border-color: #400040;
}
.navbar-default .navbar-brand {
color: #ffffff;
}
.navbar-default .navbar-brand:hover, .navbar-default .navbar-brand:focus {
color: #ffffff;
}
.navbar-default .navbar-text {
color: #ffffff;
}
.navbar-default .navbar-nav > li > a {
color: #ffffff;
}
.navbar-default .navbar-nav > li > a:hover, .navbar-default .navbar-nav > li > a:focus {
color: #ffffff;
}
.navbar-default .navbar-nav > .active > a, .navbar-default .navbar-nav > .active > a:hover, .navbar-default .navbar-nav > .active > a:focus {
color: #ffffff;
background-color: #400040;
}
.navbar-default .navbar-nav > .open > a, .navbar-default .navbar-nav > .open > a:hover, .navbar-default .navbar-nav > .open > a:focus {
color: #ffffff;
background-color: #400040;
}
.navbar-default .navbar-toggle {
border-color: #400040;
}
.navbar-default .navbar-toggle:hover, .navbar-default .navbar-toggle:focus {
background-color: #400040;
}
.navbar-default .navbar-toggle .icon-bar {
background-color: #ffffff;
}
.navbar-default .navbar-collapse,
.navbar-default .navbar-form {
border-color: #ffffff;
}
.navbar-default .navbar-link {
color: #ffffff;
}
.navbar-default .navbar-link:hover {
color: #ffffff;
}
@media (max-width: 767px) {
.navbar-default .navbar-nav .open .dropdown-menu > li > a {
color: #ffffff;
}
.navbar-default .navbar-nav .open .dropdown-menu > li > a:hover, .navbar-default .navbar-nav .open .dropdown-menu > li > a:focus {
color: #ffffff;
}
.navbar-default .navbar-nav .open .dropdown-menu > .active > a, .navbar-default .navbar-nav .open .dropdown-menu > .active > a:hover, .navbar-default .navbar-nav .open .dropdown-menu > .active > a:focus {
color: #ffffff;
background-color: #400040;
}
}
.navbar-nav > li > a {padding-top:5px !important; padding-bottom:5px !important;}
.navbar {min-height:30px !important}
.navbar-brand {
float: left;
padding: 15px;
padding-top: 5px;
padding-right: 15px;
padding-bottom: 5px;
padding-left: 15px;
font-size: 18px;
line-height: 18px;
height: 30px;
}
/* Tooltips */
.blue-tooltip + .tooltip > .tooltip-inner {background-color: #FF;}
.blue-tooltip + .tooltip > .tooltip-arrow { border-bottom-color:#FF; }
.tooltip.top .tooltip-arrow {
bottom: 0;
left: 50%;
margin-left: -5px;
border-top-color: #000000;
border-width: 5px 5px 0;
}
.tooltip-inner {
text-align: left;
color: #000;
background: #fff;
border: solid 1px #000000;
max-width: 450px
}
.tooltip.bottom .tooltip-arrow {
top: 0;
left: 50%;
margin-left: -5px;
border-bottom-color: #000000;
border-width: 0 5px 5px;
}
/* pre */
pre {
word-wrap: code;
white-space: pre-wrap;
background-color:white;
}
/* Container -Fluid */
.container-fluid {
padding: 0 2px;
}
@media (min-width: 768px) {
.container-fluid {
padding: 0 5px;
}
}
.container-fluid .row {
margin: 0px;
}
.row-padding {
margin-top: 25px;
margin-bottom: 25px;
}
/* Width for the text field to enter a bug report number in the reports page.
* We put a maximum width to override the width value coming from `form-control'. */
.form-bug-number-entry {
max-width: 100px;
}
/* Default width for the entries in a table like layout. */
.form-inline .form-control {
width: 95%;
}
.form-inline .checkbox {
font-weight: initial;
vertical-align: top;
}
/* Note that there is also a class called label. */
label {
padding-right: 5px;
}
.label {
padding: 0px;
padding-right: 5px;
}
.label-primary-api-default {
display: inline-block;
width: 105px;
text-align: left;
background: #fff;
color: #000;
font-size: 100%;
text-align: right;
}
.label-primary-api-interactions {
display: inline-block;
padding-right: 5px;
text-align: left;
color: #000;
font-size: 100%;
}
pre {
padding: 1.5px;
display: block;
margin: 0 0 10px;
font-size: 12px;
font-family: monospace;
line-height: 1.428571429;
word-break: break-word;
word-wrap: break-word;
color: #333;
border: 0px;
border-radius: 4px;
}
/* No padding, so that nested columns are always properly aligned. */
.col-xs-1,.col-sm-1,.col-md-1,.col-lg-1,.col-xs-2,.col-sm-2,.col-md-2,.col-lg-2,.col-xs-3,.col-sm-3,.col-md-3,.col-lg-3,.col-xs-4,.col-sm-4,.col-md-4,.col-lg-4,.col-xs-5,.col-sm-5,.col-md-5,.col-lg-5,.col-xs-6,.col-sm-6,.col-md-6,.col-lg-6,.col-xs-7,.col-sm-7,.col-md-7,.col-lg-7,.col-xs-8,.col-sm-8,.col-md-8,.col-lg-8,.col-xs-9,.col-sm-9,.col-md-9,.col-lg-9,.col-xs-10,.col-sm-10,.col-md-10,.col-lg-10,.col-xs-11,.col-sm-11,.col-md-11,.col-lg-11,.col-xs-12,.col-sm-12,.col-md-12,.col-lg-12 {
padding-left: 0px;
padding-right: 0px;
}
.table>thead>tr>th,.table>tbody>tr>th,.table>tfoot>tr>th,.table>thead>tr>td,.table>tbody>tr>td,.table>tfoot>tr>td {
padding:2px;
vertical-align: middle;
}
.form-control{
height:inherit;
padding: 1px 2px;
margin: 1px;
}
.btn {
padding: 1px 12px;
margin: 1px;
min-width: 100px;
}
.dropdown-toggle, .login {
cursor: pointer;
}
.pager {
margin:10px 0;
}
.pager li>a,.pager li>span {
padding:1px 12px;
border-radius:8px;
}
.well {
padding: 9px;
margin-bottom: 10px;
min-height: 44px;
}
.panel-heading {
background-color: #ddeaf2 !important;
}
.private-panel-border {
border: solid 1px #DBA458 !important;
}
.private-panel {
background-color: #f2eadd !important;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

View File

@@ -1,108 +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 ROC = ROC || { };
$('body').on('click',"a[rel='node']",function(e){
e.preventDefault();
/*
if uncomment the above line, html5 nonsupported browers won't change the url but will display the ajax content;
if commented, html5 nonsupported browers will reload the page to the specified link.
*/
//get the link location that was clicked
pageurl = $(this).attr('href');
spinner = "<span class='loading'><h3>Loading content..</h3><img src='/static/images/ajax-loader.gif' alt='loading...' class='spinner'></span>";
//to get the ajax content and display in div with class 'main'
$.ajax({url:pageurl+'?rel=node',success: function(data){
$('.main').html(data);
}});
//to change the browser URL to the given link location
//if(pageurl!=window.location){
//window.history.pushState({path:pageurl},'',pageurl);
//}
//stop refreshing to the page given in
return false;
});
$('body').on('click',"a[rel='register']",function(e){
e.preventDefault();
/*
if uncomment the above line, html5 nonsupported browers won't change the url but will display the ajax content;
if commented, html5 nonsupported browers will reload the page to the specified link.
*/
//get the link location that was clicked
pageurl = $(this).attr('href');
spinner = "<span class='loading'><h3>Loading content..</h3><img src='/static/images/ajax-loader.gif' alt='loading...' class='spinner'></span>";
//to get the ajax content and display in div with class 'main'
$.ajax({url:pageurl+'?rel=node',success: function(data){
$('.main').html(data);
}});
//to change the browser URL to the given link location
//if(pageurl!=window.location){
//window.history.pushState({path:pageurl},'',pageurl);
//}
//stop refreshing to the page given in
return false;
});
$("a[rel='node']").click(function(e){
e.preventDefault();
/*
if uncomment the above line, html5 nonsupported browers won't change the url but will display the ajax content;
if commented, html5 nonsupported browers will reload the page to the specified link.
*/
//get the link location that was clicked
pageurl = $(this).attr('href');
spinner = "<span class='loading'><h3>Loading content..</h3><img src='/static/images/ajax-loader.gif' alt='loading...' class='spinner'></span>";
//to get the ajax content and display in div with class 'main'
$.ajax({url:pageurl+'?rel=node',success: function(data){
$('.main').html(data);
}});
//to change the browser URL to the given link location
//if(pageurl!=window.location){
//window.history.pushState({path:pageurl},'',pageurl);
//}
//stop refreshing to the page given in
return false;
});

View File

@@ -1,40 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
{include file="master2/head.tpl"/}
</head>
<body>
<!-- Site Navigation -->
{include file="master2/site_navigation.tpl"/}
<!--<header class="main-navi">
{include file="master2/header.tpl"/}
</header> -->
<div class="container">
<hr>
<div class="row">
<main class="main">
{include file="master2/content.tpl"/}
</main>
</div>
</div>
<div id="footer">
<footer class="site-footer">
{include file="master2/footer.tpl"/}
</footer>
</div>
{if condition="$web"}
{include file="master2/optional_enhancement_js.tpl"/}
{/if}
{if condition="$html"}
{include file="master2/optional_enhancement_js.tpl"/}
{/if}
</body>
</html>

View File

@@ -1,11 +0,0 @@
<div itemscope itemtype="http://schema.org/ItemList">
<h2 itemprop="name">Top most recent nodes</h2><br>
<meta itemprop="itemListOrder" content="Descending" />
{foreach from="$nodes" item="item"}
<div class="page-header">
<h3><span itemprop="itemListElement"><a href="{$host/}/node/{$item.id/}" rel="node"><strong>{$item.title/}</strong></a></span> <small>{$item.summary/} - {$item.publication_date_output/} </small></h3>
</div>
{/foreach}
</div>

View File

@@ -1,18 +0,0 @@
<h3> Error: {$code/} </h3>
{assign name="status400" value="400"/}
{assign name="status404" value="404"/}
{assign name="status500" value="500"/}
{if condition="$code ~ $status500"}
<p>Internal server error, for the request <strong>{$request/}</string> </p>
{/if}
{if condition="$code ~ $status404"}
<p> Resourse not found, for the request <strong>{$request/}</string> </p>
{/if}
{if condition="$code ~ $status400"}
<p> Bad request, the request <strong>{$request/}</string> is not valid</p>
{/if}

View File

@@ -1,7 +0,0 @@
<small>
<center>
<p class="text-muted"><a href="#" target="_blank" class="info">API Documentation </a>&nbsp;&nbsp;&nbsp;
<a href="#" target="_blank" class="info">Questions? Comments? Let us know! </a></p>
<p>© Copyright 2014 Eiffel Software -- <a href="#" target="_blank" class="info">Privacy Policy</a>
</center>
</small>

View File

@@ -1,10 +0,0 @@
<meta charset="utf-8">
<link rel="icon" href="{$host/}/static/images/favicon.ico">
<title>Eiffel RESTonCMS</title>
{if condition="$web"}
{include file="master2/optional_styling_css.tpl"/}
{/if}
{if condition="$html"}
{include file="master2/optional_styling_css.tpl"/}
{/if}

View File

@@ -1,2 +0,0 @@
<h1>RESTonCMS</h1>
<p>Tagline</p>

View File

@@ -1,5 +0,0 @@
<p>You have successfully signed out</p>
You may want to return
Press this neat little button:<a href="{$host/}/">Take Me Home </a>

View File

@@ -1,5 +0,0 @@
<!--<ul>
<li class="main-navi-item"><a href="">Nav1</a></li>
<li><a href="">Nav2</a></li>
</ul>
-->

View File

@@ -1,5 +0,0 @@
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
{if condition="$web"}
<script src="{$host/}/static/js/roc.js"></script>
{/if}

View File

@@ -1,9 +0,0 @@
{if condition="$html"}
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css">
<link rel="stylesheet" href="http://getbootstrap.com/assets/css/docs.min.css">
{/if}
{if condition="$web"}
<link rel="stylesheet" href="{$host/}/static/css/bootstrap.css">
<link rel="stylesheet" href="{$host/}/static/css/dashboard.css">
{/if}

View File

@@ -1,27 +0,0 @@
<nav id="" class="navbar navbar-default navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand" href="{$host/}" rel="home">Rest on CMS</a>
</div>
<div class="collapse navbar-collapse" id="navbarCollapse">
<ul class="nav navbar-nav">
<li class="ListOfNodes"><a title="Nodes" href="{$host/}/nodes" rel="node">List of Nodes</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
{if isset="$user"}
<li><a>{$user/}</a></li>
<li><a title="Node" href="{$host/}/node" rel="node">New Node</a></li>
<li><a title="Logoff" href="{$host/}/logoff" rel="logoff">Logoff</a></li>
{/if}
{unless isset="$user"}
<li><a title="Login" href="{$host/}/login" rel="login">Login</a></li>
<li><a title="Register" href="{$host/}/user" rel="register">Register</a></li>
{/unless}
</ul>
</div>
</div>
</nav>

View File

@@ -1,8 +0,0 @@
{if isset="$user"}
<a title="Logoff" class="" href="{$host/}/logoff">Logoff</a>
{/if}
{unless isset="$user"}
<a title="Login" class="" href="{$host/}/login">Login</a>
<a title="Register" class="" href="{$host/}/Register">Register</a>
{/unless}
<a title="Nodes" class="" href="{$host/}/nodes">List of Nodes</a>

View File

@@ -1,174 +0,0 @@
{if condition="html"}
<!DOCTYPE html>
<html lang="en">
<head>
{include file="master2/head.tpl"/}
</head>
<body>
{/if}
{unless condition="$web"}
<!-- Site Navigation -->
{include file="master2/site_navigation.tpl"/}
{/unless}
{if condition="html"}
<div class="container">
<hr>
<div class="row">
<main class="main">
{/if}
<div class="bs-docs-example">
{if condition="$web"}
<ul id="myTab" class="nav nav-tabs" role="tablist">
<li class=""><a href="#view" role="tab" data-toggle="tab">View</a></li>
<li class="active"><a href="#edit" role="tab" data-toggle="tab">Edit</a></li>
<li class=""><a href="#delete" role="tab" data-toggle="tab">Delete</a></li>
</ul>
{/if}
{if condition="$html"}
<ul id="myTab" class="nav nav-tabs" role="tablist">
<li class=""><a href="#view" role="tab" data-toggle="tab">View</a></li>
<li class="active"><a href="#edit" role="tab" data-toggle="tab">Edit</a></li>
<li class=""><a href="#delete" role="tab" data-toggle="tab">Delete</a></li>
</ul>
{/if}
<div id="myTabContent" class="tab-content">
<div class="tab-pane" id="view">
{if isset="$node"}
<hr>
<div class="container-fluid">
<div class="row" itemscope itemtype="http://schema.org/Article">
<div class="row">
<div class="col-sm-6 col-md-4 col-lg-3"><h1><span itemprop="name">{$node.title/}</span></h1></div>
</div>
<div class="row">
<div class="col-sm-6 col-md-4 col-lg-3"><span itemprop="text">{$node.content/}<span></div>
</div>
</div>
</div>
{/if}
</div>
<div class="tab-pane fade active in" id="edit">
{if isset="$user"}
<hr>
<div class="container-fluid">
<div class="col-xs-12" itemscope itemtype="http://schema.org/Article">
{if isset="$node"}
<form class="form-inline well" action="{$host/}/node/{$node.id/}" itemprop="url" method="POST">
<input type="hidden" name="method" value="PUT">
{/if}
{unless isset="$node"}
<form class="form-inline well" action="{$host/}/node" itemprop="url" method="POST">
{/unless/}
<fieldset>
<legend>Edit Node</legend>
<div class="span3">
<p>Add or Edit a Node</p>
</div>
<div class="row">
<div class="col-xs-1">
{if isset="$node"}
<label><span itemprop="name"><a href="{$host/}/node/{$node.id/}/title" rel="node">Title:</a></span></label>
{/if}
{unless isset="$node"}
<label><span itemprop="name">Title:</span> </label>
{/unless}
</div>
<div class="col-xs-7">
<input id="title" type="text" class="form-control" name="title" placeholder="Title" required value="{$node.title/}"/>
</div>
</div>
<div class="row">
<div class="col-xs-1">
{if isset="$node"}
<label> <span itemprop="description"><a href="{$host/}/node/{$node.id/}/content" rel="node">Summary:</a></span></label>
{/if}
{unless isset="$node"}
<label> <span itemprop="description">Summary:</span></label>
{/unless}
</div>
<div class="col-xs-7">
<textarea id="summary" rows="3" class="form-control" cols="100" name="summary" placeholder="Node summary" required>{$node.summary/}</textarea>
</div>
</div>
<div class="row">
<div class="col-xs-1">
{if isset="$node"}
<label> <span itemprop="text"><a href="{$host/}/node/{$node.id/}/content" rel="node">Content</a></span> </label>
{/if}
{unless isset="$node"}
<label> <span itemprop="text">Content:</span> </label>
{/unless}
</div>
<div class="col-xs-7">
<textarea id="content" rows="25" cols="100" class="form-control" name="content" placeholder="Node content" required>{$node.content/}</textarea>
</div>
</div>
<div>
<label>
<span>&nbsp;</span>
<input type="Submit" value="Send" />
</label>
</div>
</fieldset>
</form>
</div>
{/if}
</div>
</div>
<div class="tab-pane" id="delete">
{if isset="$user"}
<hr>
<div class="container-fluid">
{if isset="$node"}
<form action="{$host/}/node/{$node.id/}" method="POST" class="">
<input type="hidden" name="method" value="DELETE">
<fieldset>
<legend>Delete Node</legend>
<div>
<label>
<span>&nbsp;</span>
<input type="Submit" value="Delete" />
</label>
</div>
</fieldset>
</form>
{/if}
</div>
{/if}
</div>
</div>
</div>
{if condition="html"}
</main>
</div>
</div>
{/if}
{if condition="html"}
<div id="footer">
<footer class="site-footer">
{include file="master2/footer.tpl"/}
</footer>
</div>
{include file="master2/optional_enhancement_js.tpl"/}
</body>
</html>
{/if}

View File

@@ -1,70 +0,0 @@
{if condition="html"}
<!DOCTYPE html>
<html lang="en">
<head>
{include file="master2/head.tpl"/}
</head>
<body>
{/if}
{unless condition="$web"}
<!-- Site Navigation -->
{include file="master2/site_navigation.tpl"/}
{/unless}
{if condition="html"}
<div class="container">
<hr>
<div class="row">
<main class="main">
{/if}
<div class="container-fluid">
<div class="col-xs-12" itemscope itemtype="http://schema.org/Article">
<form class="form-inline well" action="{$host/}/node/{$id/}/content" method="POST" class="">
<input type="hidden" name="method" value="PUT">
<fieldset>
<legend>Edit Node Content</legend>
<div class="row">
<div class="col-xs-1">
<label> <span itemprop="text">Content:</span> </label>
</div>
<div class="col-xs-7">
<textarea id="content" rows="25" cols="100" class="form-control" name="content" placeholder="Node content" required>{$content/}</textarea>
</div>
</div>
<div>
<label>
<span>&nbsp;</span>
<input type="Submit" value="Update" />
</label>
</div>
</fieldset>
</form>
</div>
</div>
{if condition="html"}
</main>
</div>
</div>
{/if}
{if condition="html"}
<div id="footer">
<footer class="site-footer">
{include file="master2/footer.tpl"/}
</footer>
</div>
{include file="master2/optional_enhancement_js.tpl"/}
</body>
</html>
{/if}

View File

@@ -1,71 +0,0 @@
{if condition="html"}
<!DOCTYPE html>
<html lang="en">
<head>
{include file="master2/head.tpl"/}
</head>
<body>
{/if}
{unless condition="$web"}
<!-- Site Navigation -->
{include file="master2/site_navigation.tpl"/}
{/unless}
{if condition="html"}
<div class="container">
<hr>
<div class="row">
<main class="main">
{/if}
<div class="container-fluid">
<div class="col-xs-12" itemscope itemtype="http://schema.org/Article">
<form class="form-inline well" action="{$host/}/node/{$id/}/summary" method="POST">
<input type="hidden" name="method" value="PUT">
<fieldset>
<legend>Edit Node Summary</legend>
<div class="row">
<div class="col-xs-1">
<label> <span itemprop="text">Summary:</span> </label>
</div>
<div class="col-xs-7">
<textarea id="summary" rows="3" cols="80" name="summary" placeholder="Node summary" required>{$summary/}</textarea>
</div>
</div>
<div>
<label>
<span>&nbsp;</span>
<input type="Submit" value="Send" />
</label>
</div>
</fieldset>
</form>
</div>
</div>
{if condition="html"}
</main>
</div>
</div>
{/if}
{if condition="html"}
<div id="footer">
<footer class="site-footer">
{include file="master2/footer.tpl"/}
</footer>
</div>
{include file="master2/optional_enhancement_js.tpl"/}
</body>
</html>
{/if}

View File

@@ -1,70 +0,0 @@
{if condition="html"}
<!DOCTYPE html>
<html lang="en">
<head>
{include file="master2/head.tpl"/}
</head>
<body>
{/if}
{unless condition="$web"}
<!-- Site Navigation -->
{include file="master2/site_navigation.tpl"/}
{/unless}
{if condition="html"}
<div class="container">
<hr>
<div class="row">
<main class="main">
{/if}
<div class="container-fluid">
<div class="col-xs-12" itemscope itemtype="http://schema.org/Article">
<form class="form-inline well" action="{$host/}/node/{$id/}/title" method="POST">
<input type="hidden" name="method" value="PUT">
<fieldset>
<legend>Edit Node Title</legend>
<div class="row">
<div class="col-xs-1">
<label> <span itemprop="text">Title:</span> </label>
</div>
<div class="col-xs-7">
<input id="title" type="text" name="title" placeholder="Title" required value="{$title/}"/>
</div>
</div>
<div>
<label>
<span>&nbsp;</span>
<input type="Submit" value="Send" />
</label>
</div>
</fieldset>
</form>
</div>
</div>
{if condition="html"}
</main>
</div>
</div>
{/if}
{if condition="html"}
<div id="footer">
<footer class="site-footer">
{include file="master2/footer.tpl"/}
</footer>
</div>
{include file="master2/optional_enhancement_js.tpl"/}
</body>
</html>
{/if}

View File

@@ -1,52 +0,0 @@
{if condition="html"}
<!DOCTYPE html>
<html lang="en">
<head>
{include file="master2/head.tpl"/}
</head>
<body>
{/if}
{unless condition="$web"}
<!-- Site Navigation -->
{include file="master2/site_navigation.tpl"/}
{/unless}
{if condition="html"}
<div class="container">
<hr>
<div class="row">
<main class="main">
{/if}
<div itemscope itemtype="http://schema.org/ItemList">
<h2 itemprop="name">List nodes</h2><br>
<meta itemprop="itemListOrder" content="Descending" />
{foreach from="$nodes" item="item"}
<div class="page-header">
<h3><span itemprop="itemListElement"><a href="{$host/}/node/{$item.id/}" rel="node"><strong>{$item.title/}</strong></a></span> <small>{$item.summary/} -{$item.publication_date_output/} </small></h3>
</div>
{/foreach}
</div>
{if condition="html"}
</main>
</div>
</div>
{/if}
{if condition="html"}
<div id="footer">
<footer class="site-footer">
{include file="master2/footer.tpl"/}
</footer>
</div>
{include file="master2/optional_enhancement_js.tpl"/}
</body>
</html>
{/if}

View File

@@ -1,100 +0,0 @@
{if condition="html"}
<!DOCTYPE html>
<html lang="en">
<head>
{include file="master2/head.tpl"/}
</head>
<body>
{/if}
{unless condition="$web"}
<!-- Site Navigation -->
{include file="master2/site_navigation.tpl"/}
{/unless}
{if condition="html"}
<div class="container">
<hr>
<div class="row">
<main class="main">
{/if}
<div class="container-fluid">
<div class="col-xs-12" itemscope itemtype="http://schema.org/Person">
<form class="form-inline well" action="{$host/}/user" data-rel="user-register" method="POST" >
<fieldset>
<legend>Register</legend>
<div class="span3">
<p>Register new user</p>
</div>
<div class="row">
<div class="col-xs-2">
<label><span itemprop="name">Username:</span> </label>
</div>
<div class="col-xs-7">
<input id="username" type="text" name="username" placeholder="Username" required/>
</div>
</div>
<div class="row" itemscope itemtype="http://schema.org/Text">
<div class="col-xs-2">
<label><span itemprop="accessCode">Password:</span> </label>
</div>
<div class="col-xs-7">
<input id="password" type="password" name="password" placeholder="Password" required/>
</div>
</div>
<div class="row" itemscope itemtype="http://schema.org/Text">
<div class="col-xs-2">
<label><span itemprop="accessCode">Re-type Password:</span> </label>
</div>
<div class="col-xs-7">
<input id="check_password" type="password" name="check_password" placeholder="Password" required/>
</div>
</div>
<div class="row">
<div class="col-xs-2">
<label><span itemprop="email">Email:</span> </label>
</div>
<div class="col-xs-7">
<input id="email" type="email" name="email" placeholder="Email" required/>
</div>
s</div>
<div>
<label>
<span>&nbsp;</span>
<input type="Submit" value="Send" />
</label>
</div>
</fieldset>
</form>
</div>
</div>
{if condition="html"}
</main>
</div>
</div>
{/if}
{if condition="html"}
<div id="footer">
<footer class="site-footer">
{include file="master2/footer.tpl"/}
</footer>
</div>
{include file="master2/optional_enhancement_js.tpl"/}
</body>
</html>
{/if}

View File

@@ -1,19 +0,0 @@
note
description: "Summary description for {ESA_APPLICATION_CONSTANTS}."
date: "$Date: 2014-08-20 15:21:15 -0300 (mi., 20 ago. 2014) $"
revision: "$Revision: 95678 $"
class
APPLICATION_CONSTANTS
feature -- Access
major: INTEGER = 0
minor: INTEGER = 1
built: STRING = "0001"
version: STRING
do
Result := major.out + "." + minor.out + "." + built
end
end

View File

@@ -1,70 +0,0 @@
note
description: "API configuration factory"
date: "$Date: 2014-08-20 15:21:15 -0300 (mi., 20 ago. 2014) $"
revision: "$Revision: 95678 $"
class
CONFIGURATION_FACTORY
inherit
SHARED_EXECUTION_ENVIRONMENT
SHARED_ERROR
feature -- Factory
roc_config (a_dir: detachable STRING): ROC_CONFIG
local
l_layout: APPLICATION_LAYOUT
l_email_service: ROC_EMAIL_SERVICE
l_database: DATABASE_CONNECTION
l_api_service: ROC_API_SERVICE
l_retried: BOOLEAN
do
if not l_retried then
if attached a_dir then
create l_layout.make_with_path (create {PATH}.make_from_string (a_dir))
else
create l_layout.make_default
end
log.write_information (generator + ".roc_config " + l_layout.path.name.out)
create l_email_service.make ((create {JSON_CONFIGURATION}).new_smtp_configuration(l_layout.application_config_path))
if attached (create {JSON_CONFIGURATION}).new_database_configuration (l_layout.application_config_path) as l_database_config then
create {DATABASE_CONNECTION_MYSQL} l_database.login_with_connection_string (l_database_config.connection_string)
create l_api_service.make (create {CMS_STORAGE_MYSQL}.make (l_database))
create Result.make (l_database, l_api_service, l_email_service, l_layout)
if (create {ROC_JSON_CONFIGURATION}).is_web_mode(l_layout.application_config_path) then
Result.mark_web
elseif (create {ROC_JSON_CONFIGURATION}).is_html_mode(l_layout.application_config_path) then
Result.mark_html
end
set_successful
else
create {DATABASE_CONNECTION_NULL} l_database.make_common
create l_api_service.make (create {CMS_STORAGE_NULL})
create Result.make (l_database, l_api_service, l_email_service, l_layout)
set_last_error ("Database Connections", generator + ".roc_config")
log.write_error (generator + ".roc_config Error database connection" )
end
else
if attached a_dir then
create l_layout.make_with_path (create {PATH}.make_from_string (a_dir))
else
create l_layout.make_default
end
create l_email_service.make ((create {JSON_CONFIGURATION}).new_smtp_configuration(l_layout.application_config_path))
create {DATABASE_CONNECTION_NULL} l_database.make_common
create l_api_service.make (create {CMS_STORAGE_NULL})
create Result.make (l_database, l_api_service, l_email_service, l_layout)
end
rescue
set_last_error_from_exception ("Database Connection execution")
log.write_critical (generator + ".roc_config Database Connection execution exceptions")
l_retried := True
retry
end
end

View File

@@ -1,48 +0,0 @@
note
description: "Summary description for {ROC_JSON_CONFIGURATION}."
date: "$Date$"
revision: "$Revision$"
class
ROC_JSON_CONFIGURATION
inherit
JSON_CONFIGURATION
feature -- Access
is_html_mode (a_path: PATH): BOOLEAN
-- Is the server running on web mode?
local
l_parser: JSON_PARSER
do
if attached json_file_from (a_path) as json_file then
l_parser := new_json_parser (json_file)
if attached {JSON_OBJECT} l_parser.parse as jv and then l_parser.is_parsed and then
attached {JSON_OBJECT} jv.item ("server") as l_server and then
attached {JSON_STRING} l_server.item ("mode") as l_mode then
Result := l_mode.item.is_case_insensitive_equal_general ("html")
end
end
end
is_web_mode (a_path: PATH): BOOLEAN
-- Is the server running on web mode?
local
l_parser: JSON_PARSER
do
if attached json_file_from (a_path) as json_file then
l_parser := new_json_parser (json_file)
if attached {JSON_OBJECT} l_parser.parse as jv and then l_parser.is_parsed and then
attached {JSON_OBJECT} jv.item ("server") as l_server and then
attached {JSON_STRING} l_server.item ("mode") as l_mode then
Result := l_mode.item.is_case_insensitive_equal_general ("web")
end
end
end
end

View File

@@ -1,29 +0,0 @@
note
description: "Template shared common features to all the templates"
date: "$Date: 2014-08-08 16:02:11 -0300 (vi., 08 ago. 2014) $"
revision: "$Revision: 95593 $"
deferred class
TEMPLATE_SHARED
inherit
ROC_TEMPLATE_PAGE
feature --
add_host (a_host: READABLE_STRING_GENERAL)
-- Add value `a_host' to `host'
do
template.add_value (a_host, "host")
end
add_user (a_user: detachable ANY)
-- Add value `a_host' to `host'
do
if attached a_user then
template.add_value (a_user,"user")
end
end
end

View File

@@ -1,143 +0,0 @@
note
description: "Summary description for {ROC_RESPONSE}."
date: "$Date$"
revision: "$Revision$"
class
ROC_RESPONSE
inherit
APP_HANDLER
TEMPLATE_SHARED
create
make
feature {NONE} -- Initialization
make (a_request: WSF_REQUEST; a_template: READABLE_STRING_32)
do
request := a_request
-- Set template to HTML
set_template_folder (html_path)
-- Build Common Template
set_template_file_name (a_template)
-- Process the current tempate.
set_value (a_request.absolute_script_url (""), "host")
if attached current_user_name (request) as l_user then
set_value (l_user, "user")
end
end
feature -- Access
request: WSF_REQUEST
feature -- Access
values: STRING_TABLE [detachable ANY]
do
Result := template.values
end
value (a_key: READABLE_STRING_GENERAL): detachable ANY
do
Result := template.values.item (a_key)
end
feature -- Element change
set_value (a_value: detachable ANY; a_key: READABLE_STRING_GENERAL)
do
template.add_value (a_value, a_key)
end
feature -- Output
send_to (res: WSF_RESPONSE)
do
process
if attached representation as l_output then
new_response (res, l_output, {HTTP_STATUS_CODE}.ok)
end
end
new_response_redirect (req: WSF_REQUEST; res: WSF_RESPONSE; a_location: READABLE_STRING_32)
-- Redirect to `a_location'
local
h: HTTP_HEADER
do
create h.make
h.put_content_type_text_html
h.put_current_date
h.put_location (a_location)
res.set_status_code ({HTTP_STATUS_CODE}.see_other)
res.put_header_text (h.string)
end
new_response_authenticate (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Handle forbidden.
local
h: HTTP_HEADER
do
create h.make
h.put_content_type_text_html
h.put_current_date
h.put_header_key_value ({HTTP_HEADER_NAMES}.header_www_authenticate, "Basic realm=%"CMS-User%"")
res.set_status_code ({HTTP_STATUS_CODE}.unauthorized)
res.put_header_text (h.string)
end
new_response_denied (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Handle forbidden.
local
h: HTTP_HEADER
do
process
create h.make
if attached representation as l_output then
h.put_content_length (l_output.count)
end
h.put_content_type_text_html
h.put_current_date
res.set_status_code ({HTTP_STATUS_CODE}.unauthorized)
res.put_header_text (h.string)
if attached representation as l_output then
res.put_string (l_output)
end
end
new_response_unauthorized (req: WSF_REQUEST; res: WSF_RESPONSE)
local
h: HTTP_HEADER
output: STRING
do
create h.make
h.put_content_type_text_html
h.put_current_date
res.set_status_code ({HTTP_STATUS_CODE}.forbidden)
res.put_header_text (h.string)
end
feature {NONE} -- Implemenation
new_response (res: WSF_RESPONSE; output: STRING; status_code: INTEGER)
local
h: HTTP_HEADER
do
create h.make
h.put_content_type_text_html
h.put_content_length (output.count)
h.put_current_date
res.set_status_code (status_code)
res.put_header_text (h.string)
res.put_string (output)
end
end

View File

@@ -1,76 +0,0 @@
note
description: "Abstract template class"
date: "$Date: 2014-08-20 15:21:15 -0300 (mi., 20 ago. 2014) $"
revision: "$Revision: 95678 $"
deferred class
ROC_TEMPLATE_PAGE
inherit
SHARED_TEMPLATE_CONTEXT
SHARED_LOGGER
ARGUMENTS
feature -- Status
representation: detachable STRING
-- String representation, if any.
set_template_folder (v: PATH)
-- Set template folder to `v'.
do
template_context.set_template_folder (v)
end
set_template_file_name (v: STRING)
-- Set `template' to `v'.
do
create template.make_from_file (v)
end
set_template (v: like template)
-- Set `template' to `v'.
do
template := v
end
template: TEMPLATE_FILE
layout: APPLICATION_LAYOUT
local
l_env: EXECUTION_ENVIRONMENT
once
create l_env
if attached separate_character_option_value ('d') as l_dir then
create Result.make_with_path (create {PATH}.make_from_string (l_dir))
else
create Result.make_default
end
end
html_path: PATH
-- Html template paths.
do
Result := layout.template_path.extended ("html")
end
feature -- Process
process
-- Process the current template.
do
template_context.enable_verbose
template.analyze
template.get_output
if attached template.output as l_output then
representation := l_output
debug
log.write_debug (generator + ".make " + l_output)
end
end
end
end

View File

@@ -1,119 +0,0 @@
note
description: "Abstract API service"
date: "$Date: 2014-08-20 15:21:15 -0300 (mi., 20 ago. 2014) $"
revision: "$Revision: 95678 $"
deferred class
ROC_ABSTRACT_API
inherit
WSF_ROUTED_SKELETON_SERVICE
undefine
requires_proxy
redefine
execute_default
end
WSF_NO_PROXY_POLICY
WSF_URI_HELPER_FOR_ROUTED_SERVICE
WSF_URI_TEMPLATE_HELPER_FOR_ROUTED_SERVICE
SHARED_CONNEG_HELPER
SHARED_LOGGER
feature {NONE} -- Initialization
make (a_esa_config: ROC_CONFIG; a_server: ROC_SERVER)
do
roc_config := a_esa_config
server := a_server
initialize_router
end
feature -- ESA
roc_config: ROC_CONFIG
-- Configuration
server: ROC_SERVER
-- Server
feature -- Router setup
setup_router
-- Setup `router'
deferred
end
layout: APPLICATION_LAYOUT
do
Result := roc_config.layout
end
feature -- Access
handle_debug (req: WSF_REQUEST; res: WSF_RESPONSE)
local
s: STRING_8
h: HTTP_HEADER
do
if req.is_get_request_method then
s := "debug"
create h.make_with_count (1)
h.put_content_type_text_html
h.put_content_length (s.count)
res.put_header_lines (h)
res.put_string (s)
else
create s.make (30_000)
across
req.form_parameters as c
loop
s.append (c.item.url_encoded_name)
s.append ("=")
s.append (c.item.string_representation)
s.append ("<br/>")
end
if s.is_empty then
req.read_input_data_into (s)
end
create h.make_with_count (1)
h.put_content_type_text_html
h.put_content_length (s.count)
res.put_header_lines (h)
res.put_string (s)
end
end
feature -- Handler
not_yet_implemented_uri_template_handler (msg: READABLE_STRING_8): WSF_URI_TEMPLATE_HANDLER
do
create {WSF_URI_TEMPLATE_AGENT_HANDLER} Result.make (agent not_yet_implemented(?, ?, msg))
end
not_yet_implemented (req: WSF_REQUEST; res: WSF_RESPONSE; msg: detachable READABLE_STRING_8)
local
m: WSF_NOT_IMPLEMENTED_RESPONSE
do
create m.make (req)
if msg /= Void then
m.set_body (msg)
end
res.send (m)
end
feature -- Default Execution
execute_default (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Dispatch requests without a matching handler.
local
do
end
end

View File

@@ -1,87 +0,0 @@
note
description: "Eiffel Suppor API configuration"
date: "$Date: 2014-08-20 15:21:15 -0300 (mi., 20 ago. 2014) $"
revision: "$Revision: 95678 $"
class
ROC_CONFIG
inherit
SHARED_ERROR
create
make
feature -- Initialization
make (a_database: DATABASE_CONNECTION; a_api_service: ROC_API_SERVICE; a_email_service: ROC_EMAIL_SERVICE; a_layout: APPLICATION_LAYOUT )
-- Create an object with defaults.
do
database := a_database
api_service := a_api_service
email_service := a_email_service
layout := a_layout
mark_api
ensure
database_set: database = a_database
api_service_set: api_service = a_api_service
email_service_set: email_service = a_email_service
layout_set: layout = a_layout
end
feature -- Access
is_successful: BOOLEAN
-- Is the configuration successful?
do
Result := successful
end
is_api: BOOLEAN
-- Is the server running on server mode API
is_web: BOOLEAN
-- Is the server running on server mode API
is_html: BOOLEAN
-- Is the server running on html mode API
database: DATABASE_CONNECTION
-- Database connection.
api_service: ROC_API_SERVICE
-- Support API.
email_service: ROC_EMAIL_SERVICE
-- Email service.
layout: APPLICATION_LAYOUT
-- Api layout.
mark_api
-- Set server mode to api.
do
is_api := True
is_html := False
is_web := False
end
mark_web
-- Set server mode to web.
do
is_web := True
is_api := False
is_html := False
end
mark_html
-- Set server mode to web.
do
is_html := True
is_api := False
is_web := False
end
end

View File

@@ -1,210 +0,0 @@
note
description: "[
application service
]"
date: "$Date: 2014-08-20 15:21:15 -0300 (mi., 20 ago. 2014) $"
revision: "$Revision: 95678 $"
class
ROC_SERVER
inherit
WSF_LAUNCHABLE_SERVICE
rename
make_and_launch as make_and_launch_service
redefine
initialize
end
WSF_FILTERED_SERVICE
WSF_FILTER
rename
execute as execute_filter
end
SHARED_EXECUTION_ENVIRONMENT
export
{NONE} all
end
APPLICATION_CONSTANTS
REFACTORING_HELPER
ARGUMENTS
create
make_and_launch
feature {NONE} -- Initialization
make_and_launch
do
setup_config
create launcher
make_and_launch_service
end
initialize
-- Initialize current service.
do
Precursor
service_options := create {WSF_SERVICE_LAUNCHER_OPTIONS_FROM_INI}.make_from_file ("roc.ini")
initialize_filter
end
feature {NONE} -- Launch operation
launcher: APPLICATION_LAUNCHER
launch (a_service: WSF_SERVICE; opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
local
l_retry: BOOLEAN
l_message: STRING
do
if not l_retry then
launcher.launch (a_service, opts)
else
-- error hanling.
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
l_message.append (l_description.as_string_32)
l_message.append ("%N%N")
elseif attached l_exception.trace as l_trace then
l_message.append (l_trace)
l_message.append ("%N%N")
else
l_message.append (l_exception.out)
l_message.append ("%N%N")
end
else
l_message.append ("The application crash without available information")
l_message.append ("%N%N")
end
roc_config.email_service.send_shutdown_email (l_message)
roc_config.log.write_emergency (generator + ".launch %N" + l_message)
end
rescue
l_retry := True
retry
end
feature {ROC_ABSTRACT_API} -- Services
api_service: ROC_REST_API
-- rest api.
local
s: like internal_api_service
do
s := internal_api_service
if s = Void then
create s.make (roc_config, Current)
internal_api_service := s
end
Result := s
end
feature {NONE} -- Internal
internal_api_service: detachable like api_service
feature -- ESA Configuraion
roc_config: ROC_CONFIG
-- Configuration.
setup_config
-- Configure API.
local
l_configuration_factory: CONFIGURATION_FACTORY
do
create l_configuration_factory
roc_config := l_configuration_factory.roc_config (separate_character_option_value ('d'))
if attached l_configuration_factory.last_error as l_error then
roc_config.set_last_error_from_handler (l_error)
else
roc_config.set_successful
end
end
feature -- Execute Filter
execute_filter (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Execute the filter.
do
res.put_header_line ("Date: " + (create {HTTP_DATE}.make_now_utc).string)
res.put_header_line ("ROCServer: " + version)
api_service.execute (req, res)
end
feature -- Filters
create_filter
-- Create `filter'.
local
f, l_filter: detachable WSF_FILTER
fh: WSF_CUSTOM_HEADER_FILTER
do
l_filter := Void
-- Header
create fh.make (1)
fh.set_next (l_filter)
fh.custom_header.put_header ("X-ROCServer: " + version)
l_filter := fh
-- Maintenance
create {WSF_MAINTENANCE_FILTER} f
f.set_next (l_filter)
l_filter := f
if launcher.is_console_output_supported then
-- Logging for nino
create {WSF_LOGGING_FILTER} f.make_with_output (io.output)
f.set_next (l_filter)
l_filter := f
end
-- CORS Authentication
create {CORS_FILTER} f
f.set_next (l_filter)
l_filter := f
-- Logger Filter
create {LOGGER_FILTER} f.make (roc_config)
f.set_next (l_filter)
l_filter := f
-- Error Filter
create {ERROR_FILTER} f.make (roc_config)
f.set_next (l_filter)
l_filter := f
-- Authentication
create {AUTHENTICATION_FILTER} f.make (roc_config)
f.set_next (l_filter)
l_filter := f
filter := l_filter
end
setup_filter
-- Setup `filter'.
local
f: WSF_FILTER
do
from
f := filter
until
not attached f.next as l_next
loop
f := l_next
end
f.set_next (Current)
end
end

View File

@@ -1,60 +0,0 @@
note
description: "Authentication filter."
author: "Olivier Ligot"
date: "$Date: 2014-08-20 15:21:15 -0300 (mi., 20 ago. 2014) $"
revision: "$Revision: 95678 $"
class
AUTHENTICATION_FILTER
inherit
WSF_URI_TEMPLATE_HANDLER
APP_ABSTRACT_HANDLER
rename
set_esa_config as make
end
WSF_FILTER
create
make
feature -- Basic operations
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Execute the filter
local
l_auth: HTTP_AUTHORIZATION
do
log.write_debug (generator + ".execute " )
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 )
end
-- A valid user
if (attached l_auth.type as l_auth_type and then l_auth_type.is_case_insensitive_equal ("basic")) and then
attached l_auth.login as l_auth_login and then attached l_auth.password as l_auth_password then
if api_service.login_valid (l_auth_login, l_auth_password) then
if attached api_service.user_by_name (l_auth_login) as l_user then
req.set_execution_variable ("user", l_user)
execute_next (req, res)
else
-- Internal server error
end
else
log.write_error (generator + ".execute login_valid failed for: " + l_auth_login )
execute_next (req, res)
end
else
log.write_error (generator + ".execute Not valid")
execute_next (req, res)
end
end
note
copyright: "2011-2012, Olivier Ligot, Jocelyn Fiat and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
end

View File

@@ -1,42 +0,0 @@
note
description: "Error filter"
date: "$Date: 2014-08-08 16:02:11 -0300 (vi., 08 ago. 2014) $"
revision: "$Revision: 95593 $"
class
ERROR_FILTER
inherit
WSF_URI_TEMPLATE_HANDLER
APP_ABSTRACT_HANDLER
rename
set_esa_config as make
end
WSF_FILTER
create
make
feature -- Basic operations
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Execute the filter
do
if roc_config.is_successful and then roc_config.api_service.successful then
log.write_information (generator + ".execute")
execute_next (req, res)
else
-- send internal server error.
end
end
note
copyright: "2011-2012, Olivier Ligot, Jocelyn Fiat and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
end

View File

@@ -1,54 +0,0 @@
note
description: "Logger filter"
date: "$Date: 2014-08-08 16:02:11 -0300 (vi., 08 ago. 2014) $"
revision: "$Revision: 95593 $"
class
LOGGER_FILTER
inherit
WSF_URI_TEMPLATE_HANDLER
APP_ABSTRACT_HANDLER
rename
set_esa_config as make
end
WSF_FILTER
create
make
feature -- Basic operations
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Execute the filter.
local
s: STRING_8
do
log.write_debug (generator + ".execute")
create s.make (2048)
if attached req.content_type as l_type then
s.append ("[length=")
s.append_natural_64 (req.content_length_value)
s.append_character (']')
s.append_character (' ')
s.append (l_type.debug_output)
s.append_character ('%N')
end
append_iterable_to ("Path parameters", req.path_parameters, s)
append_iterable_to ("Query parameters", req.query_parameters, s)
append_iterable_to ("Form parameters", req.form_parameters, s)
if not s.is_empty then
log.write_debug (generator + ".execute" + s)
end
execute_next (req, res)
end
note
copyright: "2011-2012, Olivier Ligot, Jocelyn Fiat and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
end

View File

@@ -1,48 +0,0 @@
note
description: "Abstrat Eiffel Support API Handler."
date: "$Date: 2014-08-08 16:02:11 -0300 (vi., 08 ago. 2014) $"
revision: "$Revision: 95593 $"
deferred class
APP_ABSTRACT_HANDLER
inherit
WSF_HANDLER
APP_HANDLER
SHARED_CONNEG_HELPER
feature -- Change
set_esa_config (a_esa_config: like roc_config)
-- Set `roc_config' to `a_esa_condig'.
do
roc_config := a_esa_config
ensure
esa_config_set: roc_config = a_esa_config
end
feature -- Access
roc_config: ROC_CONFIG
-- Configuration.
api_service: ROC_API_SERVICE
-- api Service.
do
Result := roc_config.api_service
end
email_service: ROC_EMAIL_SERVICE
-- Email Service.
do
Result := roc_config.email_service
end
is_web: BOOLEAN
do
Result := roc_config.is_web
end
end

View File

@@ -1,98 +0,0 @@
note
description: "Summary description for {ESA_HANDLER}."
date: "$Date: 2014-08-20 15:21:15 -0300 (mi., 20 ago. 2014) $"
revision: "$Revision: 95678 $"
class
APP_HANDLER
inherit
SHARED_LOGGER
feature -- User
current_user_name (req: WSF_REQUEST): detachable READABLE_STRING_32
-- Current user name or Void in case of Guest users.
note
EIS: "src=eiffel:?class=AUTHENTICATION_FILTER&feature=execute"
do
if attached {CMS_USER} current_user (req) as l_user then
Result := l_user.name
end
end
current_user (req: WSF_REQUEST): detachable CMS_USER
-- Current user or Void in case of Guest user.
note
EIS: "eiffel:?class=AUTHENTICATION_FILTER&feature=execute"
do
if attached {CMS_USER} req.execution_variable ("user") as l_user then
Result := l_user
end
end
feature -- Media Type
current_media_type (req: WSF_REQUEST): detachable READABLE_STRING_32
-- Current media type or Void if it's not acceptable.
do
if attached {STRING} req.execution_variable ("media_type") as l_type then
Result := l_type
end
end
feature -- Absolute Host
absolute_host (req: WSF_REQUEST; a_path:STRING): STRING
do
Result := req.absolute_script_url (a_path)
if Result.last_index_of ('/', Result.count) = Result.count then
Result.remove_tail (1)
end
log.write_debug (generator + ".absolute_host " + Result )
end
feature -- Compression
current_compression (req: WSF_REQUEST): detachable READABLE_STRING_32
-- Current compression encoding or Void if it's not acceptable.
do
if attached {STRING} req.execution_variable ("compression") as l_encoding then
Result := l_encoding
end
end
feature {NONE} -- Implementations
append_iterable_to (a_title: READABLE_STRING_8; it: detachable ITERABLE [WSF_VALUE]; s: STRING_8)
local
n: INTEGER
do
if it /= Void then
across it as c loop
n := n + 1
end
if n > 0 then
s.append (a_title)
s.append_character (':')
s.append_character ('%N')
across
it as c
loop
s.append (" - ")
s.append (c.item.url_encoded_name)
s.append_character (' ')
s.append_character ('{')
s.append (c.item.generating_type)
s.append_character ('}')
s.append_character ('=')
s.append (c.item.debug_output.as_string_8)
s.append_character ('%N')
end
end
end
end
end

View File

@@ -1,57 +0,0 @@
note
description: "Summary description for {NAVIGATION_HANDLER}."
date: "$Date$"
revision: "$Revision$"
class
NAVIGATION_HANDLER
inherit
APP_ABSTRACT_HANDLER
rename
set_esa_config as make
end
WSF_FILTER
WSF_URI_HANDLER
rename
execute as uri_execute,
new_mapping as new_uri_mapping
end
WSF_RESOURCE_HANDLER_HELPER
redefine
do_get
end
REFACTORING_HELPER
create
make
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
feature -- HTTP Methods
do_get (req: WSF_REQUEST; res: WSF_RESPONSE)
-- <Precursor>
local
l_page: ROC_RESPONSE
do
create l_page.make (req, "modules/navigation.tpl")
l_page.send_to (res)
end
end

View File

@@ -1,190 +0,0 @@
note
description: "Summary description for {NEW_CONTENT_HANDLER}."
date: "$Date$"
revision: "$Revision$"
class
NODE_CONTENT_HANDLER
inherit
APP_ABSTRACT_HANDLER
rename
set_esa_config as make
end
WSF_FILTER
WSF_URI_HANDLER
rename
execute as uri_execute,
new_mapping as new_uri_mapping
end
WSF_URI_TEMPLATE_HANDLER
rename
execute as uri_template_execute,
new_mapping as new_uri_template_mapping
select
new_uri_template_mapping
end
WSF_RESOURCE_HANDLER_HELPER
redefine
do_get,
do_post,
do_put
end
REFACTORING_HELPER
create
make
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
uri_template_execute (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Execute request handler
do
execute_methods (req, res)
end
feature -- HTTP Methods
do_get (req: WSF_REQUEST; res: WSF_RESPONSE)
-- <Precursor>
local
l_page: ROC_RESPONSE
do
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_service.node (l_id.integer_value) as l_node then
create l_page.make (req, "modules/node_content.tpl")
l_page.set_value (l_node.content, "content")
l_page.set_value (l_id.value, "id")
l_page.set_value (roc_config.is_web, "web")
l_page.set_value (roc_config.is_html, "html")
l_page.send_to (res)
else
do_error (req, res, l_id)
end
else
-- Todo extract method
create l_page.make (req, "master2/error.tpl")
l_page.set_value ("500", "code")
l_page.set_value (req.absolute_script_url (req.path_info), "request")
l_page.send_to (res)
end
else
(create {ROC_RESPONSE}.make(req,"")).new_response_unauthorized (req, res)
end
end
do_post (req: WSF_REQUEST; res: WSF_RESPONSE)
-- <Precursor>
local
u_node: CMS_NODE
l_page: ROC_RESPONSE
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_service.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)
else
create l_page.make (req, "master2/error.tpl")
l_page.set_value ("500", "code")
l_page.set_value (req.absolute_script_url (req.path_info), "request")
l_page.send_to (res)
end
end
else
do_error (req, res, l_id)
end
else
create l_page.make (req, "master2/error.tpl")
l_page.set_value ("500", "code")
l_page.set_value (req.absolute_script_url (req.path_info), "request")
l_page.send_to (res)
end
else
(create {ROC_RESPONSE}.make(req,"")).new_response_unauthorized (req, res)
end
end
do_put (req: WSF_REQUEST; res: WSF_RESPONSE)
-- <Precursor>
local
u_node: CMS_NODE
l_page: ROC_RESPONSE
do
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_service.node (l_id.integer_value) as l_node then
u_node := extract_data_form (req)
u_node.set_id (l_id.integer_value)
api_service.update_node_content (l_user.id, u_node.id, u_node.content)
(create {ROC_RESPONSE}.make (req, "")).new_response_redirect (req, res, req.absolute_script_url (""))
else
do_error (req, res, l_id)
end
else
create l_page.make (req, "master2/error.tpl")
l_page.set_value ("500", "code")
l_page.set_value (req.absolute_script_url (req.path_info), "request")
l_page.send_to (res)
end
else
(create {ROC_RESPONSE}.make(req,"")).new_response_unauthorized (req, res)
end
end
feature -- Error
do_error (req: WSF_REQUEST; res: WSF_RESPONSE; a_id: WSF_STRING)
-- Handling error.
local
l_page: ROC_RESPONSE
do
create l_page.make (req, "master2/error.tpl")
if a_id.is_integer then
-- resource not found
l_page.set_value ("404", "code")
else
-- bad request
l_page.set_value ("400", "code")
end
l_page.set_value (req.absolute_script_url (req.path_info), "request")
l_page.send_to(res)
end
feature -- {NONE} Form data
extract_data_form (req: WSF_REQUEST): CMS_NODE
-- Extract request form data and build a object
-- Node
do
create Result.make ("", "", "")
if attached {WSF_STRING}req.form_parameter ("content") as l_content then
Result.set_content (l_content.value)
end
end
end

View File

@@ -1,225 +0,0 @@
note
description: "Summary description for {NODE_HANDLER}."
date: "$Date$"
revision: "$Revision$"
class
NODE_HANDLER
inherit
APP_ABSTRACT_HANDLER
rename
set_esa_config as make
end
WSF_FILTER
WSF_URI_HANDLER
rename
execute as uri_execute,
new_mapping as new_uri_mapping
end
WSF_URI_TEMPLATE_HANDLER
rename
execute as uri_template_execute,
new_mapping as new_uri_template_mapping
select
new_uri_template_mapping
end
WSF_RESOURCE_HANDLER_HELPER
redefine
do_get,
do_post,
do_put,
do_delete
end
REFACTORING_HELPER
create
make
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
uri_template_execute (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Execute request handler
do
execute_methods (req, res)
end
feature -- HTTP Methods
do_get (req: WSF_REQUEST; res: WSF_RESPONSE)
-- <Precursor>
local
l_page: ROC_RESPONSE
do
-- 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_service.node (l_id.integer_value) as l_node then
create l_page.make (req, "modules/node.tpl")
l_page.set_value (l_node, "node")
l_page.set_value (roc_config.is_web, "web")
l_page.set_value (roc_config.is_html, "html")
l_page.send_to (res)
else
do_error (req, res, l_id)
end
else
-- Factory
new_node (req, res)
end
end
do_post (req: WSF_REQUEST; res: WSF_RESPONSE)
-- <Precursor>
local
u_node: CMS_NODE
l_page: ROC_RESPONSE
do
to_implement ("Check user 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_service.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 ("DELETE") then
do_delete (req, res)
elseif l_method.is_case_insensitive_equal ("PUT") then
do_put (req, res)
else
create l_page.make (req, "master2/error.tpl")
l_page.set_value ("500", "code")
l_page.set_value (req.absolute_script_url (req.path_info), "request")
l_page.send_to (res)
end
end
else
do_error (req, res, l_id)
end
else
-- New node
u_node := extract_data_form (req)
u_node.set_author (l_user)
api_service.new_node (u_node)
(create {ROC_RESPONSE}.make (req, "")).new_response_redirect (req, res, req.absolute_script_url (""))
end
else
(create {ROC_RESPONSE}.make(req,"")).new_response_unauthorized (req, res)
end
end
do_put (req: WSF_REQUEST; res: WSF_RESPONSE)
-- <Precursor>
local
u_node: CMS_NODE
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_service.node (l_id.integer_value) as l_node then
u_node := extract_data_form (req)
u_node.set_id (l_id.integer_value)
api_service.update_node (l_user.id,u_node)
(create {ROC_RESPONSE}.make (req, "")).new_response_redirect (req, res, req.absolute_script_url (""))
else
do_error (req, res, l_id)
end
else
-- Internal server error
end
else
(create {ROC_RESPONSE}.make(req,"")).new_response_unauthorized (req, res)
end
end
do_delete (req: WSF_REQUEST; res: WSF_RESPONSE)
-- <Precursor>
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_service.node (l_id.integer_value) as l_node then
api_service.delete_node (l_id.integer_value)
(create {ROC_RESPONSE}.make (req, "")).new_response_redirect (req, res, req.absolute_script_url (""))
else
do_error (req, res, l_id)
end
else
-- Internal server error
end
else
(create {ROC_RESPONSE}.make(req,"")).new_response_unauthorized (req, res)
end
end
feature -- Error
do_error (req: WSF_REQUEST; res: WSF_RESPONSE; a_id: WSF_STRING)
-- Handling error.
local
l_page: ROC_RESPONSE
do
create l_page.make (req, "master2/error.tpl")
if a_id.is_integer then
-- resource not found
l_page.set_value ("404", "code")
else
-- bad request
l_page.set_value ("400", "code")
end
l_page.set_value (req.absolute_script_url (req.path_info), "request")
l_page.send_to (res)
end
feature {NONE} -- Node
new_node (req: WSF_REQUEST; res: WSF_RESPONSE)
local
l_page: ROC_RESPONSE
do
if attached current_user_name (req) then
create l_page.make (req, "modules/node.tpl")
l_page.set_value (roc_config.is_web, "web")
l_page.set_value (roc_config.is_html, "html")
l_page.send_to (res)
else
(create {ROC_RESPONSE}.make (req, "")).new_response_unauthorized (req, res)
end
end
feature -- {NONE} Form data
extract_data_form (req: WSF_REQUEST): CMS_NODE
-- Extract request form data and build a object
-- Node
do
create Result.make ("", "", "")
if attached {WSF_STRING} req.form_parameter ("title") as l_title then
Result.set_title (l_title.value)
end
if attached {WSF_STRING} req.form_parameter ("summary") as l_summary then
Result.set_summary (l_summary.value)
end
if attached {WSF_STRING} req.form_parameter ("content") as l_content then
Result.set_content (l_content.value)
end
end
end

View File

@@ -1,199 +0,0 @@
note
description: "Summary description for {NODE_SUMMARY_HANDLER}."
date: "$Date$"
revision: "$Revision$"
class
NODE_SUMMARY_HANDLER
inherit
APP_ABSTRACT_HANDLER
rename
set_esa_config as make
end
WSF_FILTER
WSF_URI_HANDLER
rename
execute as uri_execute,
new_mapping as new_uri_mapping
end
WSF_URI_TEMPLATE_HANDLER
rename
execute as uri_template_execute,
new_mapping as new_uri_template_mapping
select
new_uri_template_mapping
end
WSF_RESOURCE_HANDLER_HELPER
redefine
do_get,
do_post,
do_put
end
REFACTORING_HELPER
create
make
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
uri_template_execute (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Execute request handler
do
execute_methods (req, res)
end
feature -- HTTP Methods
do_get (req: WSF_REQUEST; res: WSF_RESPONSE)
-- <Precursor>
local
l_page: ROC_RESPONSE
do
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_service.node (l_id.integer_value) as l_node then
create l_page.make (req, "modules/node_summary.tpl")
l_page.set_value (l_node.summary, "summary")
l_page.set_value (roc_config.is_web, "web")
l_page.set_value (roc_config.is_html, "html")
l_page.set_value (l_id.value, "id")
l_page.send_to (res)
else
do_error (req, res, l_id)
end
else
create l_page.make (req, "master2/error.tpl")
l_page.set_value ("500", "code")
l_page.set_value (req.absolute_script_url (req.path_info), "request")
l_page.send_to (res)
end
else
(create {ROC_RESPONSE}.make(req,"")).new_response_unauthorized (req, res)
end
end
do_post (req: WSF_REQUEST; res: WSF_RESPONSE)
-- <Precursor>
local
u_node: CMS_NODE
l_page: ROC_RESPONSE
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_service.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)
else
create l_page.make (req, "master2/error.tpl")
l_page.set_value ("500", "code")
l_page.set_value (req.absolute_script_url (req.path_info), "request")
l_page.send_to (res)
end
end
else
do_error (req, res, l_id)
end
else
create l_page.make (req, "master2/error.tpl")
l_page.set_value ("500", "code")
l_page.set_value (req.absolute_script_url (req.path_info), "request")
l_page.send_to (res)
end
else
(create {ROC_RESPONSE}.make(req,"")).new_response_unauthorized (req, res)
end
end
do_put (req: WSF_REQUEST; res: WSF_RESPONSE)
-- <Precursor>
local
u_node: CMS_NODE
l_page: ROC_RESPONSE
do
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_service.node (l_id.integer_value) as l_node then
u_node := extract_data_form (req)
u_node.set_id (l_id.integer_value)
api_service.update_node_summary (l_user.id,u_node.id, u_node.summary)
(create {ROC_RESPONSE}.make (req, "")).new_response_redirect (req, res, req.absolute_script_url (""))
else
do_error (req, res, l_id)
end
else
create l_page.make (req, "master2/error.tpl")
l_page.set_value ("500", "code")
l_page.set_value (req.absolute_script_url (req.path_info), "request")
l_page.send_to (res)
end
else
(create {ROC_RESPONSE}.make(req,"")).new_response_unauthorized (req, res)
end
end
feature -- Error
do_error (req: WSF_REQUEST; res: WSF_RESPONSE; a_id: WSF_STRING)
-- Handling error.
local
l_page: ROC_RESPONSE
do
create l_page.make (req, "master2/error.tpl")
if a_id.is_integer then
-- resource not found
l_page.set_value ("404", "code")
else
-- bad request
l_page.set_value ("400", "code")
end
l_page.set_value (req.absolute_script_url (req.path_info), "request")
l_page.send_to(res)
end
feature {NONE} -- Node
new_node (req: WSF_REQUEST; res: WSF_RESPONSE)
local
l_page: ROC_RESPONSE
do
create l_page.make (req, "modules/node.tpl")
l_page.send_to (res)
end
feature -- {NONE} Form data
extract_data_form (req: WSF_REQUEST): CMS_NODE
-- Extract request form data and build a object
-- Node
do
create Result.make ("", "", "")
if attached {WSF_STRING}req.form_parameter ("summary") as l_summary then
Result.set_summary (l_summary.value)
end
end
end

View File

@@ -1,199 +0,0 @@
note
description: "Summary description for {NODE_TITLE_HANDLER}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
NODE_TITLE_HANDLER
inherit
APP_ABSTRACT_HANDLER
rename
set_esa_config as make
end
WSF_FILTER
WSF_URI_HANDLER
rename
execute as uri_execute,
new_mapping as new_uri_mapping
end
WSF_URI_TEMPLATE_HANDLER
rename
execute as uri_template_execute,
new_mapping as new_uri_template_mapping
select
new_uri_template_mapping
end
WSF_RESOURCE_HANDLER_HELPER
redefine
do_get,
do_post,
do_put
end
REFACTORING_HELPER
create
make
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
uri_template_execute (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Execute request handler
do
execute_methods (req, res)
end
feature -- HTTP Methods
do_get (req: WSF_REQUEST; res: WSF_RESPONSE)
-- <Precursor>
local
l_page: ROC_RESPONSE
do
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_service.node (l_id.integer_value) as l_node then
create l_page.make (req, "modules/node_title.tpl")
l_page.set_value (l_node.title, "title")
l_page.set_value (l_id.value, "id")
l_page.set_value (roc_config.is_web, "web")
l_page.set_value (roc_config.is_html, "html")
l_page.send_to (res)
else
do_error (req, res, l_id)
end
else
create l_page.make (req, "master2/error.tpl")
l_page.set_value ("500", "code")
l_page.set_value (req.absolute_script_url (req.path_info), "request")
l_page.send_to (res)
end
else
(create {ROC_RESPONSE}.make(req,"")).new_response_unauthorized (req, res)
end
end
do_post (req: WSF_REQUEST; res: WSF_RESPONSE)
-- <Precursor>
local
u_node: CMS_NODE
l_page: ROC_RESPONSE
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_service.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)
else
create l_page.make (req, "master2/error.tpl")
l_page.set_value ("500", "code")
l_page.set_value (req.absolute_script_url (req.path_info), "request")
l_page.send_to (res)
end
end
else
do_error (req, res, l_id)
end
else
create l_page.make (req, "master2/error.tpl")
l_page.set_value ("500", "code")
l_page.set_value (req.absolute_script_url (req.path_info), "request")
l_page.send_to (res)
end
else
(create {ROC_RESPONSE}.make(req,"")).new_response_unauthorized (req, res)
end
end
do_put (req: WSF_REQUEST; res: WSF_RESPONSE)
-- <Precursor>
local
u_node: CMS_NODE
l_page: ROC_RESPONSE
do
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_service.node (l_id.integer_value) as l_node then
u_node := extract_data_form (req)
u_node.set_id (l_id.integer_value)
api_service.update_node_title (l_user.id,u_node.id, u_node.title)
(create {ROC_RESPONSE}.make (req, "")).new_response_redirect (req, res, req.absolute_script_url (""))
else
do_error (req, res, l_id)
end
else
create l_page.make (req, "master2/error.tpl")
l_page.set_value ("500", "code")
l_page.set_value (req.absolute_script_url (req.path_info), "request")
l_page.send_to (res)
end
else
(create {ROC_RESPONSE}.make(req,"")).new_response_unauthorized (req, res)
end
end
feature -- Error
do_error (req: WSF_REQUEST; res: WSF_RESPONSE; a_id: WSF_STRING)
-- Handling error.
local
l_page: ROC_RESPONSE
do
create l_page.make (req, "master2/error.tpl")
if a_id.is_integer then
-- resource not found
l_page.set_value ("404", "code")
else
-- bad request
l_page.set_value ("400", "code")
end
l_page.set_value (req.absolute_script_url (req.path_info), "request")
l_page.send_to (res)
end
feature {NONE} -- Node
new_node (req: WSF_REQUEST; res: WSF_RESPONSE)
local
l_page: ROC_RESPONSE
do
create l_page.make (req, "modules/node.tpl")
l_page.send_to (res)
end
feature -- {NONE} Form data
extract_data_form (req: WSF_REQUEST): CMS_NODE
-- Extract request form data and build a object
-- Node
do
create Result.make ("", "", "")
if attached {WSF_STRING} req.form_parameter ("title") as l_title then
Result.set_title (l_title.value)
end
end
end

View File

@@ -1,62 +0,0 @@
note
description: "Summary description for {NODES_HANDLER}."
date: "$Date$"
revision: "$Revision$"
class
NODES_HANDLER
inherit
APP_ABSTRACT_HANDLER
rename
set_esa_config as make
end
WSF_FILTER
WSF_URI_HANDLER
rename
execute as uri_execute,
new_mapping as new_uri_mapping
end
WSF_RESOURCE_HANDLER_HELPER
redefine
do_get
end
REFACTORING_HELPER
create
make
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
feature -- HTTP Methods
do_get (req: WSF_REQUEST; res: WSF_RESPONSE)
-- <Precursor>
local
l_page: ROC_RESPONSE
do
create l_page.make (req, "modules/nodes.tpl")
l_page.set_value (api_service.nodes, "nodes")
l_page.set_value (roc_config.is_web, "web")
l_page.set_value (roc_config.is_html, "html")
l_page.send_to (res)
end
end

View File

@@ -1,63 +0,0 @@
note
description: "Handle Login using Basic Authentication"
date: "$Date: 2014-08-08 16:02:11 -0300 (vi., 08 ago. 2014) $"
revision: "$Revision: 95593 $"
class
ROC_LOGIN_HANDLER
inherit
APP_ABSTRACT_HANDLER
rename
set_esa_config as make
end
WSF_URI_HANDLER
rename
execute as uri_execute,
new_mapping as new_uri_mapping
end
WSF_FILTER
WSF_RESOURCE_HANDLER_HELPER
redefine
do_get
end
REFACTORING_HELPER
create
make
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
feature -- HTTP Methods
do_get (req: WSF_REQUEST; res: WSF_RESPONSE)
-- <Precursor>
do
if attached {STRING_32} current_user_name (req) as l_user then
(create {ROC_RESPONSE}.make(req,"")).new_response_redirect (req, res, req.absolute_script_url(""))
else
(create {ROC_RESPONSE}.make(req,"")).new_response_authenticate (req, res)
end
end
end

View File

@@ -1,59 +0,0 @@
note
description: "Handle Logoff for Basic Authentication"
date: "$Date: 2014-08-08 16:02:11 -0300 (vi., 08 ago. 2014) $"
revision: "$Revision: 95593 $"
class
ROC_LOGOFF_HANDLER
inherit
APP_ABSTRACT_HANDLER
rename
set_esa_config as make
end
WSF_URI_HANDLER
rename
execute as uri_execute,
new_mapping as new_uri_mapping
end
WSF_RESOURCE_HANDLER_HELPER
redefine
do_get
end
REFACTORING_HELPER
create
make
feature -- execute
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Execute request handler.
do
execute_methods (req, res)
end
uri_execute (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Execute request handler.
do
execute_methods (req, res)
end
feature -- HTTP Methods
do_get (req: WSF_REQUEST; res: WSF_RESPONSE)
-- <Precursor>
do
log.write_information(generator + ".do_get Processing logoff")
if attached req.query_parameter ("prompt") as l_prompt then
(create {ROC_RESPONSE}.make(req,"")).new_response_unauthorized (req, res)
else
(create {ROC_RESPONSE}.make(req,"master2/logoff.tpl")).new_response_denied (req, res)
end
end
end

View File

@@ -1,63 +0,0 @@
note
description: "ROOT_HANDLER."
date: "$Date: 2014-08-08 16:02:11 -0300 (vi., 08 ago. 2014) $"
revision: "$Revision: 95593 $"
class
ROC_ROOT_HANDLER
inherit
APP_ABSTRACT_HANDLER
rename
set_esa_config as make
end
WSF_FILTER
WSF_URI_HANDLER
rename
execute as uri_execute,
new_mapping as new_uri_mapping
end
WSF_RESOURCE_HANDLER_HELPER
redefine
do_get
end
REFACTORING_HELPER
create
make
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
feature -- HTTP Methods
do_get (req: WSF_REQUEST; res: WSF_RESPONSE)
-- <Precursor>
local
l_page: ROC_RESPONSE
do
create l_page.make (req, "layout2.tpl")
l_page.set_value (api_service.recent_nodes (0,5), "nodes")
l_page.set_value (is_web, "web")
l_page.set_value (roc_config.is_html, "html")
l_page.send_to (res)
end
end

View File

@@ -1,163 +0,0 @@
note
description: "Summary description for {USER_HANDLER}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
USER_HANDLER
inherit
APP_ABSTRACT_HANDLER
rename
set_esa_config as make
end
WSF_FILTER
WSF_URI_HANDLER
rename
execute as uri_execute,
new_mapping as new_uri_mapping
end
WSF_URI_TEMPLATE_HANDLER
rename
execute as uri_template_execute,
new_mapping as new_uri_template_mapping
select
new_uri_template_mapping
end
WSF_RESOURCE_HANDLER_HELPER
redefine
do_get,
do_post,
do_put,
do_delete
end
REFACTORING_HELPER
create
make
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
uri_template_execute (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Execute request handler
do
execute_methods (req, res)
end
feature -- HTTP Methods
do_get (req: WSF_REQUEST; res: WSF_RESPONSE)
-- <Precursor>
local
l_page: ROC_RESPONSE
do
-- Existing node
create l_page.make (req, "modules/register.tpl")
l_page.set_value (roc_config.is_web, "web")
l_page.set_value (roc_config.is_html, "html")
l_page.send_to (res)
end
do_post (req: WSF_REQUEST; res: WSF_RESPONSE)
-- <Precursor>
local
u_node: CMS_NODE
l_page: ROC_RESPONSE
do
-- New user
api_service.new_user (extract_data_form (req))
if api_service.successful then
(create {ROC_RESPONSE}.make (req, "")).new_response_redirect (req, res, req.absolute_script_url (""))
else
end
end
do_put (req: WSF_REQUEST; res: WSF_RESPONSE)
-- <Precursor>
local
u_node: CMS_NODE
do
end
do_delete (req: WSF_REQUEST; res: WSF_RESPONSE)
-- <Precursor>
do
end
feature -- Error
do_error (req: WSF_REQUEST; res: WSF_RESPONSE; a_id: WSF_STRING)
-- Handling error.
local
l_page: ROC_RESPONSE
do
create l_page.make (req, "master2/error.tpl")
if a_id.is_integer then
-- resource not found
l_page.set_value ("404", "code")
else
-- bad request
l_page.set_value ("400", "code")
end
l_page.set_value (req.absolute_script_url (req.path_info), "request")
l_page.send_to (res)
end
feature {NONE} -- Node
new_node (req: WSF_REQUEST; res: WSF_RESPONSE)
local
l_page: ROC_RESPONSE
do
if attached current_user_name (req) then
create l_page.make (req, "modules/node.tpl")
l_page.send_to (res)
else
(create {ROC_RESPONSE}.make (req, "")).new_response_unauthorized (req, res)
end
end
feature -- {NONE} Form data
extract_data_form (req: WSF_REQUEST): CMS_USER
-- Extract request form data and build a object
-- user
do
create Result.make ("")
if attached {WSF_STRING} req.form_parameter ("username") as l_username then
Result.set_name (l_username)
end
if
attached {WSF_STRING} req.form_parameter ("password") as l_password and then
attached {WSF_STRING} req.form_parameter ("check_password") as l_check_password and then
l_password.value.is_case_insensitive_equal (l_check_password.value)
then
Result.set_password (l_password)
end
if attached {WSF_STRING} req.form_parameter ("email") as l_email then
Result.set_email (l_email)
end
end
end

View File

@@ -1,126 +0,0 @@
note
description: "API Service facade to the underlying business logic"
date: "$Date: 2014-08-20 15:21:15 -0300 (mi., 20 ago. 2014) $"
revision: "$Revision: 95678 $"
class
ROC_API_SERVICE
inherit
SHARED_ERROR
REFACTORING_HELPER
create make
feature -- Initialize
make (a_storage: CMS_STORAGE)
-- Create the API service with an storege `a_storage'.
do
storage := a_storage
set_successful
ensure
storage_set: storage = a_storage
end
feature -- Access
login_valid (l_auth_login, l_auth_password: READABLE_STRING_32): BOOLEAN
local
l_security: SECURITY_PROVIDER
do
Result := storage.is_valid_credential (l_auth_login, l_auth_password)
end
feature -- Access: Node
nodes: LIST[CMS_NODE]
-- List of nodes.
do
fixme ("Implementation")
Result := storage.recent_nodes (0, 10)
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
fixme ("Check preconditions")
Result := storage.node (a_id)
end
feature -- Change: Node
new_node (a_node: CMS_NODE)
-- Add a new node
do
storage.save_node (a_node)
end
delete_node (a_id: INTEGER_64)
do
storage.delete_node (a_id)
end
update_node (a_id: like {CMS_USER}.id; a_node: CMS_NODE)
do
storage.update_node (a_id,a_node)
end
update_node_title (a_id: like {CMS_USER}.id; a_node_id: like {CMS_NODE}.id; a_title: READABLE_STRING_32)
do
fixme ("Check preconditions")
storage.update_node_title (a_id,a_node_id,a_title)
end
update_node_summary (a_id: like {CMS_USER}.id; a_node_id: like {CMS_NODE}.id; a_summary: READABLE_STRING_32)
do
fixme ("Check preconditions")
storage.update_node_summary (a_id,a_node_id, a_summary)
end
update_node_content (a_id: like {CMS_USER}.id; a_node_id: like {CMS_NODE}.id; a_content: READABLE_STRING_32)
do
fixme ("Check preconditions")
storage.update_node_content (a_id,a_node_id, a_content)
end
feature -- Access: User
user_by_name (a_username: READABLE_STRING_32): detachable CMS_USER
do
Result := storage.user_by_name (a_username)
end
feature -- Change User
new_user (a_user: CMS_USER)
-- Add a new user `a_user'.
do
if
attached a_user.password as l_password and then
attached a_user.email as l_email
then
storage.save_user (a_user)
else
fixme ("Add error")
end
end
feature {NONE} -- Implemenataion
storage: CMS_STORAGE
-- Persistence storage
end

View File

@@ -1,127 +0,0 @@
note
description: "Provides email access"
date: "$Date: 2014-08-20 15:21:15 -0300 (mi., 20 ago. 2014) $"
revision: "$Revision: 95678 $"
class
ROC_EMAIL_SERVICE
inherit
SHARED_ERROR
create
make
feature {NONE} -- Initialization
make (a_smtp_server: READABLE_STRING_32)
-- Create an instance of {ESA_EMAIL_SERVICE} with an smtp_server `a_smtp_server'.
-- Using "noreplies@eiffel.com" as admin email.
local
l_address_factory: INET_ADDRESS_FACTORY
do
-- Get local host name needed in creation of SMTP_PROTOCOL.
create l_address_factory
create smtp_protocol.make (a_smtp_server, l_address_factory.create_localhost.host_name)
set_successful
end
admin_email: IMMUTABLE_STRING_8
-- Administrator email.
once
Result := "noreplies@eiffel.com"
end
webmaster_email: IMMUTABLE_STRING_8
-- Webmaster email.
once
Result := "webmaster@eiffel.com"
end
smtp_protocol: SMTP_PROTOCOL
-- SMTP protocol.
feature -- Basic Operations
send_template_email (a_to, a_token, a_host: STRING)
-- Send successful registration message containing activation code `a_token' to `a_to'.
require
attached_to: a_to /= Void
attached_token: a_token /= Void
attached_host: a_host /= Void
local
l_content: STRING
l_url: URL_ENCODER
l_path: PATH
l_html: HTML_ENCODER
l_email: EMAIL
do
if successful then
log.write_information (generator + ".send_post_registration_email to [" + a_to + "]" )
create l_path.make_current
create l_url
create l_html
create l_content.make (1024)
l_content.append ("Thank you for registering at CMS.%N%NTo complete your registration, please click on this link to activate your account:%N%N")
l_content.append (a_host)
l_content.append ("/activation?code=")
l_content.append (l_url.encoded_string (a_token))
l_content.append ("&email=")
l_content.append (l_url.encoded_string (a_to))
l_content.append ("%N%NOnce there, please enter the following information and then click the Activate Account, button.%N%N")
l_content.append ("Your e-mail: ")
l_content.append (l_html.encoded_string (a_to))
l_content.append ("%N%NYour activation code: ")
l_content.append (l_html.encoded_string(a_token))
l_content.append ("%N%NThank you for joining us.%N%N CMS team.")
l_content.append (Disclaimer)
-- Create our message.
create l_email.make_with_entry (admin_email, a_to)
l_email.set_message (l_content)
l_email.add_header_entry ({EMAIL_CONSTANTS}.H_subject, "CMS Site: Account Activation")
send_email (l_email)
end
end
send_shutdown_email (a_message: READABLE_STRING_GENERAL)
-- Send email shutdown cause by an unexpected condition.
local
l_email: EMAIL
l_content: STRING
do
create l_email.make_with_entry (admin_email, webmaster_email)
create l_content.make (2048)
l_content.append (a_message.as_string_32)
l_email.set_message (l_content)
l_email.add_header_entry ({EMAIL_CONSTANTS}.H_subject, "ROC API exception")
send_email (l_email)
end
feature {NONE} -- Implementation
send_email (a_email: EMAIL)
-- Send the email represented by `a_email'.
local
l_retried: BOOLEAN
do
if not l_retried then
log.write_information (generator + ".send_email Process send email.")
smtp_protocol.initiate_protocol
smtp_protocol.transfer (a_email)
smtp_protocol.close_protocol
log.write_information (generator + ".send_email Email sent.")
set_successful
else
log.write_error (generator + ".send_email Email not send" + last_error_message )
end
rescue
set_last_error_from_exception (generator + ".send_email")
l_retried := True
retry
end
Disclaimer: STRING = "This email is generated automatically, and the address is not monitored for responses. If you try contacting us by using %"reply%", you will not receive an answer."
-- Email not monitored disclaimer.
end

View File

@@ -1,185 +0,0 @@
note
description: "[
REST API configuration
We manage URI and Uri templates using Routers. They are used to delegate calls (to the corresponing handlers) based on a URI template.
We define a Rooter and attach handlers to it.
]"
date: "$Date: 2014-08-08 16:02:11 -0300 (vi., 08 ago. 2014) $"
revision: "$Revision: 95593 $"
class
ROC_REST_API
inherit
ROC_ABSTRACT_API
create
make
feature -- Initialization
setup_router
-- Setup `router'.
local
fhdl: WSF_FILE_SYSTEM_HANDLER
do
configure_api_root
configure_api_node
configure_api_navigation
configure_api_login
configure_api_nodes
configure_api_node_title
configure_api_node_summary
configure_api_node_content
configure_api_logoff
configure_api_register
create fhdl.make_hidden_with_path (layout.www_path)
fhdl.disable_index
fhdl.set_not_found_handler (agent (ia_uri: READABLE_STRING_8; ia_req: WSF_REQUEST; ia_res: WSF_RESPONSE)
do
execute_default (ia_req, ia_res)
end)
router.handle_with_request_methods ("/", fhdl, router.methods_GET)
end
feature -- Configure Resources Routes
configure_api_root
local
l_root_handler:ROC_ROOT_HANDLER
l_methods: WSF_REQUEST_METHODS
do
create l_root_handler.make (roc_config)
create l_methods
l_methods.enable_get
router.handle_with_request_methods ("/", l_root_handler, l_methods)
end
configure_api_node
local
l_report_handler: NODE_HANDLER
l_methods: WSF_REQUEST_METHODS
do
create l_report_handler.make (roc_config)
create l_methods
l_methods.enable_get
l_methods.enable_post
l_methods.enable_put
router.handle_with_request_methods ("/node", l_report_handler, l_methods)
create l_report_handler.make (roc_config)
create l_methods
l_methods.enable_get
l_methods.enable_post
l_methods.enable_put
l_methods.enable_delete
router.handle_with_request_methods ("/node/{id}", l_report_handler, l_methods)
end
configure_api_navigation
local
l_report_handler: NAVIGATION_HANDLER
l_methods: WSF_REQUEST_METHODS
do
create l_report_handler.make (roc_config)
create l_methods
l_methods.enable_get
router.handle_with_request_methods ("/navigation", l_report_handler, l_methods)
end
configure_api_login
local
l_report_handler: ROC_LOGIN_HANDLER
l_methods: WSF_REQUEST_METHODS
do
create l_report_handler.make (roc_config)
create l_methods
l_methods.enable_get
router.handle_with_request_methods ("/login", l_report_handler, l_methods)
end
configure_api_logoff
local
l_report_handler: ROC_LOGOFF_HANDLER
l_methods: WSF_REQUEST_METHODS
do
create l_report_handler.make (roc_config)
create l_methods
l_methods.enable_get
router.handle_with_request_methods ("/logoff", l_report_handler, l_methods)
end
configure_api_nodes
local
l_report_handler: NODES_HANDLER
l_methods: WSF_REQUEST_METHODS
do
create l_report_handler.make (roc_config)
create l_methods
l_methods.enable_get
router.handle_with_request_methods ("/nodes", l_report_handler, l_methods)
end
configure_api_node_summary
local
l_report_handler: NODE_SUMMARY_HANDLER
l_methods: WSF_REQUEST_METHODS
do
create l_report_handler.make (roc_config)
create l_methods
l_methods.enable_get
l_methods.enable_post
l_methods.enable_put
router.handle_with_request_methods ("/node/{id}/summary", l_report_handler, l_methods)
end
configure_api_node_title
local
l_report_handler: NODE_TITLE_HANDLER
l_methods: WSF_REQUEST_METHODS
do
create l_report_handler.make (roc_config)
create l_methods
l_methods.enable_get
l_methods.enable_post
l_methods.enable_put
router.handle_with_request_methods ("/node/{id}/title", l_report_handler, l_methods)
end
configure_api_node_content
local
l_report_handler: NODE_CONTENT_HANDLER
l_methods: WSF_REQUEST_METHODS
do
create l_report_handler.make (roc_config)
create l_methods
l_methods.enable_get
l_methods.enable_post
l_methods.enable_put
router.handle_with_request_methods ("/node/{id}/content", l_report_handler, l_methods)
end
configure_api_register
local
l_report_handler: USER_HANDLER
l_methods: WSF_REQUEST_METHODS
do
create l_report_handler.make (roc_config)
create l_methods
l_methods.enable_get
l_methods.enable_post
l_methods.enable_put
router.handle_with_request_methods ("/user", l_report_handler, l_methods)
end
end

View File

@@ -1,48 +0,0 @@
note
description: "Conneg Helper"
date: "$Date: 2014-08-08 16:02:11 -0300 (vi., 08 ago. 2014) $"
revision: "$Revision: 95593 $"
class
SHARED_CONNEG_HELPER
feature -- Access
conneg (req: WSF_REQUEST): SERVER_CONTENT_NEGOTIATION
-- Content negotiatior for all requests.
once
create Result.make ({HTTP_MIME_TYPES}.text_html, "en", "UTF-8", "identity")
end
mime_types_supported (req: WSF_REQUEST): LIST [STRING]
-- All values for Accept header that `Current' can serve.
do
create {ARRAYED_LIST [STRING]} Result.make_from_array (<<{HTTP_MIME_TYPES}.text_html, "application/vnd.collection+json">>)
Result.compare_objects
ensure
mime_types_supported_includes_default: Result.has (conneg (req).default_media_type)
end
media_type_variants (req: WSF_REQUEST): HTTP_ACCEPT_MEDIA_TYPE_VARIANTS
-- Media type negotiation.
do
Result := conneg (req).media_type_preference (mime_types_supported (req), req.http_accept)
end
compression_supported (req: WSF_REQUEST): LIST [STRING]
-- All values for Accept-Encofing header that `Current' can serve.
do
create {ARRAYED_LIST [STRING]} Result.make_from_array (<<"identity","deflate">>)
Result.compare_objects
ensure
compression_supported_includes_default: Result.has (conneg (req).default_encoding)
end
compression_variants (req: WSF_REQUEST): HTTP_ACCEPT_ENCODING_VARIANTS
-- Compression negotiation.
do
Result := conneg (req).encoding_preference (compression_supported (req), req.http_accept_encoding)
end
end

View File

@@ -1,58 +0,0 @@
note
description: "Provide input validation"
date: "$Date: 2014-08-08 16:02:11 -0300 (vi., 08 ago. 2014) $"
revision: "$Revision: 95593 $"
deferred class
ROC_INPUT_VALIDATOR
feature -- Basic Operations
input_from (a_request: ITERABLE [WSF_VALUE])
-- Update current object using parameters extracted from QUERY_STRING.
-- If there are errors they are set to the errors parameter.
do
if attached {STRING_TABLE[WSF_VALUE]} a_request as l_table_request then
validate (l_table_request)
end
end
feature -- Validation
validate (a_request: STRING_TABLE [WSF_VALUE])
-- Validate input for control `a_request'.
deferred
end
feature -- Access
acceptable_query_parameters: ARRAY[STRING]
-- The parameters are optionals, more parameters is a bad request, the order is not important.
deferred
end
feature -- Errors
errors: STRING_TABLE[READABLE_STRING_32]
-- Hash table with errors and descriptions.
has_error: BOOLEAN
-- Has errors the last request?
do
Result := not errors.is_empty
end
error_message: STRING
-- String representation.
do
create Result.make_empty
across errors as c loop
Result.append (c.item)
Result.append ("%N")
end
end
end -- class EFA_INPUT_VALIDATOR

View File

@@ -0,0 +1,87 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-15-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-15-0 http://www.eiffel.com/developers/xml/configuration-1-15-0.xsd" name="demo" uuid="3643E657-BCBE-46AA-931B-71EAEA877A18" library_target="demo">
<description>Example/demo for Eiffel ROC CMS library</description>
<target name="common" abstract="true">
<root class="DEMO_CMS_SERVER" feature="make_and_launch"/>
<file_rule>
<exclude>/.svn$</exclude>
<exclude>/CVS$</exclude>
<exclude>/EIFGENs$</exclude>
</file_rule>
<option debug="true" warning="true" full_class_checking="false" is_attached_by_default="true" void_safety="all" syntax="transitional">
<debug name="dbglog" enabled="true"/>
</option>
<setting name="executable_name" value="demo"/>
<setting name="concurrency" value="thread"/>
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<library name="cms" location="..\..\cms-safe.ecf" readonly="false">
<option>
<assertions precondition="true" postcondition="true" supplier_precondition="true"/>
</option>
</library>
<library name="cms_admin_module" location="..\..\modules\admin\admin-safe.ecf" readonly="false"/>
<library name="cms_app_env" location="..\..\library\app_env\app_env-safe.ecf" readonly="false"/>
<library name="cms_auth_module" location="..\..\modules\auth\auth-safe.ecf" readonly="false"/>
<library name="cms_basic_auth_module" location="..\..\modules\basic_auth\basic_auth-safe.ecf" readonly="false"/>
<library name="cms_blog_module" location="..\..\modules\blog\cms_blog_module-safe.ecf" readonly="false"/>
<library name="cms_contact_module" location="..\..\modules\contact\contact-safe.ecf" readonly="false"/>
<library name="cms_demo_module" location="modules\demo\cms_demo_module-safe.ecf" readonly="false"/>
<library name="cms_email_service" location="..\..\library\email\email-safe.ecf" readonly="false"/>
<library name="cms_feed_aggregator_module" location="..\..\modules\feed_aggregator\feed_aggregator-safe.ecf" readonly="false"/>
<library name="cms_google_search_module" location="..\..\modules\google_search\google_search-safe.ecf" readonly="false" use_application_options="true"/>
<library name="cms_model" location="..\..\library\model\cms_model-safe.ecf" readonly="false"/>
<library name="cms_node_module" location="..\..\modules\node\node-safe.ecf" readonly="false"/>
<library name="cms_oauth_20_module" location="..\..\modules\oauth20\oauth20-safe.ecf" readonly="false"/>
<library name="cms_openid_module" location="..\..\modules\openid\openid-safe.ecf" readonly="false"/>
<library name="cms_recent_changes_module" location="..\..\modules\recent_changes\recent_changes-safe.ecf" readonly="false"/>
<library name="cms_seo_module" location="..\..\modules\seo\seo-safe.ecf" readonly="false"/>
<library name="cms_session_auth_module" location="..\..\modules\session_auth\cms_session_auth-safe.ecf" readonly="false"/>
<library name="cms_taxnomy_module" location="..\..\modules\taxonomy\taxonomy-safe.ecf" readonly="false"/>
<library name="persistence_sqlite3" location="..\..\library\persistence\sqlite3\sqlite3-safe.ecf" readonly="false">
<option>
<assertions/>
</option>
</library>
<!--
<library name="persistence_store_odbc" location="..\..\library\persistence\store_odbc\store_odbc-safe.ecf"/>
<library name="persistence_store_mysql" location="..\..\library\persistence\store_mysql\store_mysql-safe.ecf" />
-->
<library name="wsf" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf-safe.ecf"/>
<library name="wsf_extension" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf_extension-safe.ecf" readonly="false"/>
</target>
<target name="demo_any" extends="common">
<setting name="concurrency" value="scoop"/>
<library name="any_launcher" location="..\..\launcher\any-safe.ecf" readonly="false"/>
<cluster name="src" location=".\src\" recursive="true"/>
</target>
<target name="demo_standalone" extends="common">
<option debug="true">
<debug name="dbglog" enabled="true"/>
</option>
<setting name="concurrency" value="scoop"/>
<variable name="httpd_ssl_disabled" value="true"/>
<library name="standalone_launcher" location="..\..\launcher\standalone-safe.ecf" readonly="false"/>
<cluster name="src" location=".\src\" recursive="true"/>
</target>
<target name="demo_standalone_none" extends="demo_standalone">
<setting name="concurrency" value="none"/>
</target>
<target name="demo_standalone_mt" extends="demo_standalone">
<setting name="concurrency" value="thread"/>
</target>
<target name="demo_standalone_scoop" extends="demo_standalone">
<setting name="concurrency" value="scoop"/>
</target>
<target name="demo_cgi" extends="common">
<setting name="concurrency" value="none"/>
<library name="cgi_launcher" location="..\..\launcher\cgi-safe.ecf" readonly="false"/>
<cluster name="src" location=".\src\" recursive="true"/>
</target>
<target name="demo_libfcgi" extends="common">
<setting name="concurrency" value="none"/>
<library name="libfcgi_launcher" location="..\..\launcher\libfcgi-safe.ecf" readonly="false"/>
<cluster name="src" location=".\src\" recursive="true"/>
</target>
<target name="demo" extends="demo_standalone">
</target>
</system>

2
examples/demo/demo.ini Normal file
View File

@@ -0,0 +1,2 @@
port=9090
#verbose=true

View File

@@ -0,0 +1,18 @@
setlocal
set ROC_CMD=call %~dp0..\..\tools\roc.bat
set ROC_CMS_DIR=%~dp0
%ROC_CMD% install --module ..\..\modules\admin --dir %ROC_CMS_DIR%
%ROC_CMD% install --module ..\..\modules\auth --dir %ROC_CMS_DIR%
%ROC_CMD% install --module ..\..\modules\basic_auth --dir %ROC_CMS_DIR%
%ROC_CMD% install --module ..\..\modules\blog --dir %ROC_CMS_DIR%
%ROC_CMD% install --module ..\..\modules\contact --dir %ROC_CMS_DIR%
%ROC_CMD% install --module ..\..\modules\feed_aggregator --dir %ROC_CMS_DIR%
%ROC_CMD% install --module ..\..\modules\google_search --dir %ROC_CMS_DIR%
%ROC_CMD% install --module ..\..\modules\node --dir %ROC_CMS_DIR%
%ROC_CMD% install --module ..\..\modules\oauth20 --dir %ROC_CMS_DIR%
%ROC_CMD% install --module ..\..\modules\openid --dir %ROC_CMS_DIR%
%ROC_CMD% install --module ..\..\modules\recent_changes --dir %ROC_CMS_DIR%
%ROC_CMD% install --module ..\..\modules\seo --dir %ROC_CMS_DIR%
%ROC_CMD% install --module ..\..\modules\session_auth --dir %ROC_CMS_DIR%
%ROC_CMD% install --module ..\..\modules\taxonomy --dir %ROC_CMS_DIR%

View File

@@ -8,10 +8,10 @@ note
revision: "$Revision: 36 $"
class
APPLICATION_LAUNCHER
APPLICATION_LAUNCHER [G -> WSF_EXECUTION create make end]
inherit
APPLICATION_LAUNCHER_I
APPLICATION_LAUNCHER_I [G]
feature -- Custom

View File

@@ -10,24 +10,28 @@ note
revision: "$Revision: 36 $"
deferred class
APPLICATION_LAUNCHER_I
APPLICATION_LAUNCHER_I [G -> WSF_EXECUTION create make end]
inherit
SHARED_EXECUTION_ENVIRONMENT
feature -- Execution
launch (a_service: WSF_SERVICE; opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
launch (opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
local
nature: like launcher_nature
do
nature := launcher_nature
if nature = Void or else nature = nature_nino then
launch_nino (a_service, opts)
if nature = Void then
launch_standalone (opts)
elseif nature = nature_standalone then
launch_standalone (opts)
elseif nature = nature_nino then
launch_nino (opts)
elseif nature = nature_cgi then
launch_cgi (a_service, opts)
launch_cgi (opts)
elseif nature = nature_libfcgi then
launch_libfcgi (a_service, opts)
launch_libfcgi (opts)
else
-- bye bye
(create {EXCEPTIONS}).die (-1)
@@ -43,14 +47,16 @@ feature {NONE} -- Access
--| and we could use WSF_DEFAULT_SERVICE_LAUNCHER to configure this at compilation time.
local
p: PATH
l_entry_name: READABLE_STRING_32
ext: detachable READABLE_STRING_32
do
create p.make_from_string (execution_environment.arguments.command_name)
if attached p.entry as l_entry then
ext := l_entry.extension
ext := l_entry.extension
end
if ext /= Void then
if ext.same_string (nature_standalone) then
Result := nature_standalone
end
if ext.same_string (nature_nino) then
Result := nature_nino
end
@@ -61,39 +67,58 @@ feature {NONE} -- Access
Result := nature_libfcgi
end
end
Result := default_nature
end
feature {NONE} -- standalone
nature_standalone: STRING = "standalone"
launch_standalone (opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
local
launcher: WSF_STANDALONE_SERVICE_LAUNCHER [G]
do
create launcher.make_and_launch (opts)
end
feature {NONE} -- nino
nature_nino: STRING = "nino"
launch_nino (a_service: WSF_SERVICE; opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
launch_nino (opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
local
launcher: WSF_NINO_SERVICE_LAUNCHER
launcher: WSF_NINO_SERVICE_LAUNCHER [G]
do
create launcher.make_and_launch (a_service, opts)
create launcher.make_and_launch (opts)
end
feature {NONE} -- cgi
nature_cgi: STRING = "cgi"
launch_cgi (a_service: WSF_SERVICE; opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
launch_cgi (opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
local
launcher: WSF_CGI_SERVICE_LAUNCHER
launcher: WSF_CGI_SERVICE_LAUNCHER [G]
do
create launcher.make_and_launch (a_service, opts)
create launcher.make_and_launch (opts)
end
feature {NONE} -- libfcgi
nature_libfcgi: STRING = "libfcgi"
launch_libfcgi (a_service: WSF_SERVICE; opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
launch_libfcgi (opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
local
launcher: WSF_LIBFCGI_SERVICE_LAUNCHER
launcher: WSF_LIBFCGI_SERVICE_LAUNCHER [G]
do
create launcher.make_and_launch (a_service, opts)
create launcher.make_and_launch (opts)
end
feature -- Default
default_nature: STRING
do
Result := nature_standalone
end

View File

@@ -8,10 +8,10 @@ note
revision: "$Revision: 36 $"
class
APPLICATION_LAUNCHER
APPLICATION_LAUNCHER [G -> WSF_EXECUTION create make end]
inherit
APPLICATION_LAUNCHER_I
APPLICATION_LAUNCHER_I [G]
feature -- Custom

Some files were not shown because too many files have changed in this diff Show More