Compare commits
344 Commits
hook_20141
...
es_rev9806
| Author | SHA1 | Date | |
|---|---|---|---|
| 6aaec0be9f | |||
| cb6d13b5f7 | |||
| 951c977892 | |||
| 2a4ebfa12e | |||
| 955852747a | |||
| 23fe22cad1 | |||
| da4b36869a | |||
| 5624892ebc | |||
|
|
e40a7969fa | ||
|
|
67fdd357df | ||
| 5b0ab76434 | |||
| a84f86d7a2 | |||
| 3f4e70b98c | |||
| 782e9397a3 | |||
| f51ddc9796 | |||
| a260bbc2c5 | |||
| eb5ae32e46 | |||
| 7fcacad5eb | |||
| 7c99f2dc83 | |||
| 57430193e3 | |||
| 62bf58ce6d | |||
| 23c395513b | |||
| d2d86ecdf2 | |||
| e90f82387f | |||
| 05472abdd7 | |||
|
|
193760b34f | ||
|
|
9263f31521 | ||
|
|
454d92f85b | ||
| 788cf3738d | |||
|
|
0e63c14613 | ||
| f6185612b2 | |||
| d37f45d958 | |||
| 872f2a177d | |||
| 3ed2f410d9 | |||
| 1b451ef142 | |||
| 50146985de | |||
| 8cdf9ba973 | |||
| 8044f7d52b | |||
| ed24eb7c94 | |||
| 43d6b4a197 | |||
| dffd06e331 | |||
| 463105f29f | |||
| abebd00a4f | |||
| ec53a2682b | |||
|
|
7b2e6ab7b4 | ||
|
|
87f4de1264 | ||
|
|
ed614a662c | ||
|
|
d54ad59e5f | ||
|
|
9173ef2ded | ||
|
|
ad9e908dc2 | ||
|
|
4584917877 | ||
|
|
f7d68d09e4 | ||
| f9ecd4956f | |||
| 18e159ad3c | |||
| 438259033a | |||
| 62e74ea6cd | |||
| 32a409b7e9 | |||
|
|
eb70af6f19 | ||
| 5f4eb2cf10 | |||
| 88bc52fffb | |||
|
|
544e6540ed | ||
| 2431d7af6c | |||
|
|
0d55bd67a2 | ||
|
|
e1727cc445 | ||
|
|
634a078282 | ||
|
|
2f65a084ac | ||
|
|
13df6fd593 | ||
| ad4f020d0e | |||
| 7a13b47131 | |||
| 923089baa1 | |||
| cfec9dc7f8 | |||
| b5e7d5d201 | |||
| e1bdcb965c | |||
| 0061afcbe8 | |||
| 6a9bc8aa42 | |||
| 1d7d79d69e | |||
| 46014da3d8 | |||
| 7cb4c0e9f4 | |||
| aff6b07c80 | |||
| 479194d6c5 | |||
| 3f123dd921 | |||
| cd0c2acd87 | |||
| 44ada4b6b1 | |||
| 8efbddc8cb | |||
| f26b81977c | |||
| bbf7456fa2 | |||
| 62ef07c86b | |||
| a422dea15d | |||
| 6fb7bf9a1d | |||
| bba1d57ce3 | |||
| c271f839e2 | |||
| 5d81f1d195 | |||
|
|
63f3ec12d0 | ||
|
|
863a1e7b98 | ||
|
|
0fe9018ce9 | ||
|
|
1ef4025caa | ||
|
|
3ebffad3d6 | ||
| 500f8f78a4 | |||
| 47573a1950 | |||
|
|
2d5f985037 | ||
|
|
eff3552ea1 | ||
| 43b8c52d34 | |||
| d8ac46f8b0 | |||
|
|
91f1a87b83 | ||
| 769c14caf8 | |||
| 3c0122d98f | |||
|
|
77487e90f3 | ||
|
|
5d498c0bf2 | ||
|
|
e42a7636ae | ||
| f55a52e4d0 | |||
| 2040a746dd | |||
|
|
d4fc9f9411 | ||
|
|
bba504df53 | ||
| 5688cffcf1 | |||
| 19e8607e54 | |||
| 2d77bf6de8 | |||
| 2d985ba05e | |||
| 1b0cc9dc07 | |||
|
|
0164c6ec6d | ||
|
|
2fe2a7f864 | ||
| 3dec559d58 | |||
|
|
dce3f71be9 | ||
| 3ea9e36e7c | |||
| 5da01fd576 | |||
| 7f4a7b3ab9 | |||
| 779064a505 | |||
| 5477bab83c | |||
| d24f124e42 | |||
| bace9657b4 | |||
| 6319d46f26 | |||
| 31095b1b66 | |||
| 16cae0047d | |||
| 85cff0b139 | |||
| cc94c59eed | |||
| 4c8af3ef66 | |||
| 37729f648a | |||
| 26dc018893 | |||
|
|
f0eff2cb98 | ||
| 011a6b7804 | |||
| 83e7f95425 | |||
|
|
4f7acc5dbd | ||
|
|
922fca80ad | ||
|
|
9d465b3d7e | ||
|
|
5288fe4d3c | ||
|
|
9722347736 | ||
|
|
a2598fff92 | ||
| 42e7763528 | |||
|
|
02fe3ba829 | ||
|
|
fe3274e29a | ||
|
|
96bae9f8fb | ||
|
|
1cef32a1fb | ||
|
|
f1e8e1da58 | ||
|
|
26276dad5d | ||
| eb9ac980e6 | |||
| 28ab4786a1 | |||
| 8294a47f17 | |||
| e45dac84c8 | |||
| bb3e3b992f | |||
| ebc5924c01 | |||
| 48b0ad5195 | |||
| ae9eea99dd | |||
|
|
268f53e53f | ||
|
|
e17fc570a1 | ||
| ba7ef17d34 | |||
|
|
c8bbac664b | ||
| 04e98dbb48 | |||
| 2886c90782 | |||
|
|
db6799d55b | ||
|
|
7c0032ada4 | ||
|
|
fa5efede2c | ||
| 0fca03a4d1 | |||
| 642b901856 | |||
| 4f3bcf290f | |||
| 6ca8a9ce82 | |||
| 2c72fe6738 | |||
| 149de898c0 | |||
| c3133c65a1 | |||
|
|
9e51df1e01 | ||
| 967871e427 | |||
| 73e0098c4d | |||
| b4407378db | |||
| f619727997 | |||
|
|
a94a8857ae | ||
| e37dbb0a62 | |||
|
|
53491274dc | ||
|
|
afced59b0c | ||
| 21800e71d3 | |||
|
|
18732a9532 | ||
| 0fc1cb68ad | |||
| 0b8bee3404 | |||
| 53a602d33c | |||
|
|
f652aa8a15 | ||
| 5578a9e622 | |||
|
|
e188625c43 | ||
|
|
96ba3c35a2 | ||
|
|
181c32a895 | ||
|
|
032cc5bdcb | ||
| b8cfff487a | |||
| af8f410684 | |||
| cede341301 | |||
| 70d53b3ef1 | |||
|
|
f056b43ddc | ||
| c871eae10e | |||
|
|
957ca96bc5 | ||
|
|
ad9dd01f22 | ||
|
|
323ac598d0 | ||
|
|
e35893fdb9 | ||
| b77c5cd93c | |||
| 77f52388c1 | |||
|
|
e8ff313c28 | ||
|
|
0bd75e7c59 | ||
|
|
9b169f70a7 | ||
|
|
601b88ab36 | ||
|
|
2b0e1a2b84 | ||
|
|
db77c4024d | ||
|
|
261aeca300 | ||
|
|
027463a910 | ||
|
|
a4c50adefa | ||
|
|
1f61126d22 | ||
|
|
fb196735b6 | ||
|
|
306b39ab78 | ||
|
|
802ad0626e | ||
|
|
470b1b2e05 | ||
|
|
57c2a7bccd | ||
|
|
4dd980963a | ||
|
|
6a782e412d | ||
|
|
0e0cd131a5 | ||
|
|
53f3162b4a | ||
| 036013a0a2 | |||
|
|
202253e414 | ||
| 50da24d1af | |||
| 91457080fd | |||
| 51699f3bd3 | |||
|
|
f72fcce440 | ||
|
|
f48f09bfdf | ||
|
|
35b186cec8 | ||
|
|
c65265b025 | ||
|
|
77bb1fe123 | ||
|
|
e4e2d662b8 | ||
|
|
f0668e660e | ||
|
|
68fb21a4c1 | ||
|
|
3b90d522f9 | ||
|
|
1c59a65983 | ||
|
|
9fbadac7ac | ||
|
|
57bf5ad0dc | ||
|
|
988f32c6c4 | ||
|
|
44d14c4100 | ||
| 29ef17226b | |||
| 9514f1de9c | |||
| fdff2bef36 | |||
| 1603086905 | |||
| 99b2fa9fdb | |||
| e17011de97 | |||
| 17fe37aedd | |||
| dd3688fab8 | |||
| 7771a452cf | |||
| 6ff7a6493c | |||
| 0eb2b70d0f | |||
| c982f0ea9c | |||
| e8bb3790ba | |||
| e206c1e133 | |||
| 5582dd9058 | |||
|
|
d54cd6032f | ||
|
|
8b24c86ff1 | ||
|
|
fc4c2e76b6 | ||
| a56338ad17 | |||
| f2bb061488 | |||
| 2b25c23977 | |||
| ea2b5b87d3 | |||
| 133c243126 | |||
|
|
734f661add | ||
|
|
e41b0631d6 | ||
|
|
98621cb265 | ||
| 9a8683a139 | |||
| f3c3407b0a | |||
| 20471923fd | |||
| b235fb30a7 | |||
| e94d860fd8 | |||
| bd6524ebe7 | |||
| ca10c57b4b | |||
| 8d59d25ace | |||
| a810b1176c | |||
|
|
e40f8ee4d2 | ||
|
|
83af7f6a38 | ||
| 02368fe3d2 | |||
| be0b5c23d2 | |||
|
|
88ec1452d8 | ||
| 5ddc2006e2 | |||
| d97c4b1a4a | |||
| 7d5869f3b9 | |||
|
|
8c74c7a268 | ||
| db9e40cec4 | |||
|
|
792880aa7a | ||
|
|
5ad8c680a6 | ||
|
|
e2f02953f4 | ||
|
|
bd26deb6c1 | ||
|
|
a9109ca8f7 | ||
| 09e5dc4032 | |||
| d082326784 | |||
| 51462829c7 | |||
| ba58fcdf75 | |||
|
|
d84f164dbd | ||
|
|
c3d022ce46 | ||
|
|
aac01e093a | ||
|
|
fb62a1bb3e | ||
|
|
6162432d52 | ||
|
|
ebed52ae01 | ||
| b58eeeac26 | |||
|
|
9169bdcd43 | ||
|
|
e36465f86d | ||
| 76190de218 | |||
|
|
0edff7853b | ||
|
|
e20a7af301 | ||
|
|
089b367c95 | ||
|
|
503f2faf08 | ||
|
|
b887c13664 | ||
|
|
bbfe063b5c | ||
|
|
1a4e2935da | ||
|
|
c3a582f85c | ||
| 8bfb66af30 | |||
| 6aad460b11 | |||
|
|
0dc12b82b8 | ||
|
|
8047880c2b | ||
|
|
48283742aa | ||
| 76bdbeaa2a | |||
|
|
44a1dd62cb | ||
|
|
1f8be4e37f | ||
|
|
d963fd218b | ||
|
|
8ab4343d5b | ||
|
|
9af6356f0a | ||
|
|
b16048eb18 | ||
| 71734a6dd7 | |||
| 9cd53c7c78 | |||
| a51d0d3c68 | |||
|
|
b3c2879b07 | ||
| e1feee51f9 | |||
|
|
2aaed89417 | ||
|
|
789b26eafa | ||
|
|
a576c38d42 | ||
| a524b80108 | |||
| 48a8ac4a1c | |||
|
|
1d4e9df917 | ||
|
|
2d5c1a5e41 | ||
|
|
fba9b598f9 |
5
.gitignore
vendored
5
.gitignore
vendored
@@ -1,4 +1,7 @@
|
||||
EIFGENs
|
||||
*.swp
|
||||
*.log*
|
||||
*.rc
|
||||
*.rc
|
||||
*.bak
|
||||
*.sqlite
|
||||
Thumbs.db
|
||||
|
||||
34
README.md
Normal file
34
README.md
Normal 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).
|
||||
|
||||
@@ -1,33 +1,37 @@
|
||||
<?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">
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-14-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-14-0 http://www.eiffel.com/developers/xml/configuration-1-14-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">
|
||||
<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">
|
||||
<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="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-safe.ecf"/>
|
||||
<library name="model" location="..\model\model-safe.ecf" readonly="false"/>
|
||||
<library name="encoder" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\text\encoder\encoder-safe.ecf" readonly="false"/>
|
||||
<library name="text_filter" location="$ISE_LIBRARY\unstable\library\text\text_filter\text_filter-safe.ecf"/>
|
||||
|
||||
<library name="error" location="$ISE_LIBRARY\contrib\library\utility\general\error\error-safe.ecf"/>
|
||||
<library name="http_authorization" location="$ISE_LIBRARY\contrib\library\network\authentication\http_authorization\http_authorization-safe.ecf" readonly="false"/>
|
||||
<library name="persistence_mysql" location="..\persistence\implementation\mysql\persistence_mysql-safe.ecf" readonly="false"/>
|
||||
<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"/>
|
||||
<library name="time" location="$ISE_LIBRARY\library\time\time-safe.ecf"/>
|
||||
<cluster name="src" location=".\src\" recursive="true">
|
||||
<file_rule>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
<exclude>/CVS$</exclude>
|
||||
<exclude>/.svn$</exclude>
|
||||
</file_rule>
|
||||
</cluster>
|
||||
<cluster name="src" location=".\src\" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
38
cms.ecf
Normal file
38
cms.ecf
Normal file
@@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-14-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-14-0 http://www.eiffel.com/developers/xml/configuration-1-14-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>/EIFGENs$</exclude>
|
||||
<exclude>/CVS$</exclude>
|
||||
<exclude>/.svn$</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>
|
||||
@@ -1,294 +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'.
|
||||
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
|
||||
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
|
||||
@@ -1,110 +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)
|
||||
initialize
|
||||
end
|
||||
|
||||
initialize
|
||||
do
|
||||
configure
|
||||
create modules.make (3)
|
||||
build_mailer
|
||||
initialize_modules
|
||||
end
|
||||
|
||||
configure
|
||||
do
|
||||
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
|
||||
end
|
||||
|
||||
initialize_modules
|
||||
local
|
||||
m: CMS_MODULE
|
||||
do
|
||||
-- -- Core
|
||||
-- create {USER_MODULE} m.make (Current)
|
||||
-- m.enable
|
||||
-- modules.extend (m)
|
||||
|
||||
-- create {ADMIN_MODULE} m.make (Current)
|
||||
-- m.enable
|
||||
-- modules.extend (m)
|
||||
|
||||
create {NODE_MODULE} m.make (Current)
|
||||
m.enable
|
||||
modules.extend (m)
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
modules: CMS_MODULE_COLLECTION
|
||||
-- <Precursor>
|
||||
|
||||
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
|
||||
|
||||
build_auth_engine
|
||||
do
|
||||
to_implement ("Not implemented authentication")
|
||||
end
|
||||
|
||||
build_mailer
|
||||
do
|
||||
to_implement ("Not implemented mailer")
|
||||
end
|
||||
|
||||
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
|
||||
@@ -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
|
||||
@@ -1,52 +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).
|
||||
local
|
||||
p: detachable PATH
|
||||
do
|
||||
p := internal_theme_path
|
||||
if p = Void then
|
||||
p := www_path.extended ("theme")
|
||||
internal_theme_path := p
|
||||
end
|
||||
Result := p
|
||||
end
|
||||
|
||||
cms_config_ini_path: PATH
|
||||
-- Database Configuration file path.
|
||||
local
|
||||
p: detachable PATH
|
||||
do
|
||||
p := internal_cms_config_ini_path
|
||||
if p = Void then
|
||||
p := config_path.extended ("cms.ini")
|
||||
internal_cms_config_ini_path := p
|
||||
end
|
||||
Result := p
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
internal_theme_path: detachable like theme_path
|
||||
|
||||
internal_cms_config_ini_path: detachable like cms_config_ini_path
|
||||
|
||||
end
|
||||
@@ -1,70 +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.
|
||||
|
||||
is_html: BOOLEAN
|
||||
-- api with progressive enhancements css and js, server side rendering.
|
||||
deferred
|
||||
end
|
||||
|
||||
is_web: BOOLEAN
|
||||
-- web: Web Site with progressive enhancements css and js and Ajax calls.
|
||||
deferred
|
||||
end
|
||||
|
||||
modules: CMS_MODULE_COLLECTION
|
||||
-- List of available modules.
|
||||
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
|
||||
|
||||
front_page_path: detachable READABLE_STRING_8
|
||||
-- Optional path defining the front page.
|
||||
-- By default "" or "/".
|
||||
|
||||
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
|
||||
|
||||
end
|
||||
@@ -1,11 +0,0 @@
|
||||
note
|
||||
description: "[
|
||||
Marker interface for CMS Hook
|
||||
]"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
CMS_HOOK
|
||||
|
||||
end
|
||||
@@ -1,33 +0,0 @@
|
||||
note
|
||||
description: "[
|
||||
Summary description for {CMS_HOOK_AUTO_REGISTER}.
|
||||
When inheriting from this class, the declared hooks are automatically
|
||||
registered, otherwise, each descendant has to add it to the cms service
|
||||
itself.
|
||||
]"
|
||||
date: "$Date: 2014-08-28 08:21:49 -0300 (ju. 28 de ago. de 2014) $"
|
||||
revision: "$Revision: 95708 $"
|
||||
|
||||
deferred class
|
||||
CMS_HOOK_AUTO_REGISTER
|
||||
|
||||
inherit
|
||||
CMS_HOOK
|
||||
|
||||
feature -- Hook
|
||||
|
||||
hook_auto_register (a_response: CMS_RESPONSE)
|
||||
do
|
||||
if attached {CMS_HOOK_MENU_ALTER} Current as h_menu_alter then
|
||||
a_response.add_menu_alter_hook (h_menu_alter)
|
||||
end
|
||||
if attached {CMS_HOOK_BLOCK} Current as h_block then
|
||||
a_response.add_block_hook (h_block)
|
||||
end
|
||||
if attached {CMS_HOOK_FORM_ALTER} Current as h_block then
|
||||
a_response.add_form_alter_hook (h_block)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,24 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {CMS_HOOK_BLOCK}."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
CMS_HOOK_BLOCK
|
||||
|
||||
inherit
|
||||
CMS_HOOK
|
||||
|
||||
feature -- Hook
|
||||
|
||||
block_list: ITERABLE [like {CMS_BLOCK}.name]
|
||||
-- List of block names, managed by current object.
|
||||
deferred
|
||||
end
|
||||
|
||||
get_block_view (a_block_id: READABLE_STRING_8; a_response: CMS_RESPONSE)
|
||||
-- Get block object identified by `a_block_id' and associate with `a_response'.
|
||||
deferred
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,28 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {CMS_BLOCK}."
|
||||
date: "$Date: 2014-08-28 08:21:49 -0300 (ju. 28 de ago. de 2014) $"
|
||||
|
||||
deferred class
|
||||
CMS_BLOCK
|
||||
|
||||
feature -- Access
|
||||
|
||||
name: READABLE_STRING_8
|
||||
deferred
|
||||
end
|
||||
|
||||
title: detachable READABLE_STRING_32
|
||||
deferred
|
||||
end
|
||||
|
||||
feature -- status report
|
||||
|
||||
is_enabled: BOOLEAN
|
||||
|
||||
feature -- Conversion
|
||||
|
||||
to_html (a_theme: CMS_THEME): STRING_8
|
||||
deferred
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,35 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {CMS_ENCODERS}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CMS_ENCODERS
|
||||
|
||||
feature -- Encoders
|
||||
|
||||
url_encoded (s: detachable READABLE_STRING_GENERAL): STRING_8
|
||||
local
|
||||
enc: URL_ENCODER
|
||||
do
|
||||
create enc
|
||||
if s /= Void then
|
||||
Result := enc.general_encoded_string (s)
|
||||
else
|
||||
create Result.make_empty
|
||||
end
|
||||
end
|
||||
|
||||
html_encoded (s: detachable READABLE_STRING_GENERAL): STRING_8
|
||||
local
|
||||
enc: HTML_ENCODER
|
||||
do
|
||||
create enc
|
||||
if s /= Void then
|
||||
Result := enc.general_encoded_string (s)
|
||||
else
|
||||
create Result.make_empty
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,41 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {CMS_MENU_BLOCK}."
|
||||
date: "$Date: 2014-08-28 08:21:49 -0300 (ju. 28 de ago. de 2014) $"
|
||||
|
||||
class
|
||||
CMS_MENU_BLOCK
|
||||
|
||||
inherit
|
||||
CMS_BLOCK
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_menu: like menu)
|
||||
do
|
||||
is_enabled := True
|
||||
menu := a_menu
|
||||
name := a_menu.name
|
||||
title := a_menu.title
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
menu: CMS_MENU
|
||||
|
||||
name: READABLE_STRING_8
|
||||
|
||||
title: detachable READABLE_STRING_32
|
||||
|
||||
is_horizontal: BOOLEAN
|
||||
|
||||
feature -- Conversion
|
||||
|
||||
to_html (a_theme: CMS_THEME): STRING_8
|
||||
do
|
||||
Result := a_theme.menu_html (menu, is_horizontal)
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,64 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {CMS_FORMATS}."
|
||||
author: ""
|
||||
date: "$Date: 2014-10-16 04:45:23 -0300 (ju. 16 de oct. de 2014) $"
|
||||
revision: "$Revision: 95932 $"
|
||||
|
||||
class
|
||||
CMS_FORMATS
|
||||
|
||||
feature -- Access
|
||||
|
||||
format (a_name: like {CONTENT_FORMAT}.name): detachable CONTENT_FORMAT
|
||||
do
|
||||
across
|
||||
all_formats as c
|
||||
until
|
||||
Result /= Void
|
||||
loop
|
||||
if c.item.name.same_string (a_name) then
|
||||
Result := c.item
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
all_formats: LIST [CONTENT_FORMAT]
|
||||
once
|
||||
create {ARRAYED_LIST [CONTENT_FORMAT]} Result.make (3)
|
||||
Result.force (plain_text)
|
||||
Result.force (full_html)
|
||||
Result.force (filtered_html)
|
||||
end
|
||||
|
||||
default_format: CONTENT_FORMAT
|
||||
do
|
||||
Result := plain_text --FIXME
|
||||
end
|
||||
|
||||
plain_text: PLAIN_TEXT_CONTENT_FORMAT
|
||||
once
|
||||
create Result
|
||||
end
|
||||
|
||||
full_html: FULL_HTML_CONTENT_FORMAT
|
||||
once
|
||||
create Result
|
||||
end
|
||||
|
||||
filtered_html: FILTERED_HTML_CONTENT_FORMAT
|
||||
once
|
||||
create Result
|
||||
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
|
||||
@@ -1,73 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {BASIC_AUTH_MODULE}."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
BASIC_AUTH_MODULE
|
||||
|
||||
inherit
|
||||
|
||||
CMS_MODULE
|
||||
redefine
|
||||
filters
|
||||
end
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
do
|
||||
name := "basic auth"
|
||||
version := "1.0"
|
||||
description := "Service to manage basic authentication"
|
||||
package := "core"
|
||||
end
|
||||
|
||||
feature -- Access: router
|
||||
|
||||
router (a_api: CMS_API): WSF_ROUTER
|
||||
-- Node router.
|
||||
do
|
||||
create Result.make (2)
|
||||
configure_api_login (a_api, Result)
|
||||
configure_api_logoff (a_api, Result)
|
||||
end
|
||||
|
||||
feature -- Access: filter
|
||||
|
||||
filters (a_api: CMS_API): detachable LIST [WSF_FILTER]
|
||||
-- Possibly list of Filter's module.
|
||||
do
|
||||
create {ARRAYED_LIST [WSF_FILTER]} Result.make (2)
|
||||
Result.extend (create {CORS_FILTER})
|
||||
Result.extend (create {BASIC_AUTH_FILTER}.make (a_api))
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation: routes
|
||||
|
||||
configure_api_login (api: CMS_API; a_router: WSF_ROUTER)
|
||||
local
|
||||
l_bal_handler: BASIC_AUTH_LOGIN_HANDLER
|
||||
l_methods: WSF_REQUEST_METHODS
|
||||
do
|
||||
create l_bal_handler.make (api)
|
||||
create l_methods
|
||||
l_methods.enable_get
|
||||
a_router.handle_with_request_methods ("/basic_auth_login", l_bal_handler, l_methods)
|
||||
end
|
||||
|
||||
configure_api_logoff (api: CMS_API; a_router: WSF_ROUTER)
|
||||
local
|
||||
l_bal_handler: BASIC_AUTH_LOGOFF_HANDLER
|
||||
l_methods: WSF_REQUEST_METHODS
|
||||
do
|
||||
create l_bal_handler.make (api)
|
||||
create l_methods
|
||||
l_methods.enable_get
|
||||
a_router.handle_with_request_methods ("/basic_auth_logoff", l_bal_handler, l_methods)
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,51 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {BASIC_AUTH_FILTER}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
BASIC_AUTH_FILTER
|
||||
|
||||
inherit
|
||||
|
||||
WSF_URI_TEMPLATE_HANDLER
|
||||
CMS_HANDLER
|
||||
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_general ("basic")) and then
|
||||
attached l_auth.login as l_auth_login and then attached l_auth.password as l_auth_password then
|
||||
if api.is_valid_credential (l_auth_login, l_auth_password) then
|
||||
if attached api.user_by_name (l_auth_login) as l_user then
|
||||
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
|
||||
|
||||
end
|
||||
@@ -1,60 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {BASIC_AUTH_LOGIN_HANDLER}."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
BASIC_AUTH_LOGIN_HANDLER
|
||||
|
||||
inherit
|
||||
CMS_HANDLER
|
||||
|
||||
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
|
||||
log.write_information(generator + ".do_get Processing basic auth login")
|
||||
if attached {STRING_32} current_user_name (req) as l_user then
|
||||
(create {CMS_GENERIC_RESPONSE}).new_response_redirect (req, res, req.absolute_script_url("/"))
|
||||
else
|
||||
(create {CMS_GENERIC_RESPONSE}).new_response_authenticate (req, res)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
@@ -1,59 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {BASIC_AUTH_LOGOFF_HANDLER}."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
BASIC_AUTH_LOGOFF_HANDLER
|
||||
|
||||
inherit
|
||||
CMS_HANDLER
|
||||
|
||||
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>
|
||||
local
|
||||
l_page: CMS_RESPONSE
|
||||
do
|
||||
log.write_information(generator + ".do_get Processing basic auth logoff")
|
||||
if attached req.query_parameter ("prompt") as l_prompt then
|
||||
(create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
|
||||
else
|
||||
create {GENERIC_VIEW_CMS_RESPONSE} l_page.make (req, res, api)
|
||||
l_page.set_status_code ({HTTP_STATUS_CODE}.unauthorized)
|
||||
l_page.execute
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,68 +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 (a_api: CMS_API): WSF_ROUTER
|
||||
-- Router configuration.
|
||||
require
|
||||
is_enabled: is_enabled
|
||||
deferred
|
||||
end
|
||||
|
||||
feature -- Hooks configuration
|
||||
|
||||
register_hooks (a_response: CMS_RESPONSE)
|
||||
-- Module hooks configuration.
|
||||
require
|
||||
is_enabled: is_enabled
|
||||
do
|
||||
end
|
||||
|
||||
feature -- Filter
|
||||
|
||||
filters (a_api: CMS_API): detachable LIST [WSF_FILTER]
|
||||
-- Optional list of filter for Current module.
|
||||
require
|
||||
is_enabled: is_enabled
|
||||
do
|
||||
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
|
||||
@@ -1,64 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {CMS_MODULE_COLLECTION}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CMS_MODULE_COLLECTION
|
||||
|
||||
inherit
|
||||
ITERABLE [CMS_MODULE]
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (nb: INTEGER)
|
||||
do
|
||||
create modules.make (nb)
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
new_cursor: INDEXABLE_ITERATION_CURSOR [CMS_MODULE]
|
||||
-- <Precursor>
|
||||
do
|
||||
Result := modules.new_cursor
|
||||
end
|
||||
|
||||
feature -- Status report
|
||||
|
||||
has (a_module: CMS_MODULE): BOOLEAN
|
||||
-- Has `a_module'?
|
||||
do
|
||||
Result := modules.has (a_module)
|
||||
end
|
||||
|
||||
count: INTEGER
|
||||
-- Number of modules.
|
||||
do
|
||||
Result := modules.count
|
||||
end
|
||||
|
||||
feature -- Element change
|
||||
|
||||
extend (a_module: CMS_MODULE)
|
||||
-- Add module
|
||||
do
|
||||
modules.force (a_module)
|
||||
end
|
||||
|
||||
remove (a_module: CMS_MODULE)
|
||||
-- Remove module
|
||||
do
|
||||
modules.prune_all (a_module)
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
modules: ARRAYED_LIST [CMS_MODULE]
|
||||
-- List of available modules.
|
||||
|
||||
end
|
||||
@@ -1,171 +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.node (l_id.integer_value) as l_node then
|
||||
create {GENERIC_VIEW_CMS_RESPONSE} l_page.make (req, res, api)
|
||||
l_page.add_variable (l_node.content, "node_content")
|
||||
l_page.add_variable (l_id.value, "id")
|
||||
l_page.execute
|
||||
else
|
||||
do_error (req, res, l_id)
|
||||
end
|
||||
else
|
||||
(create {ERROR_500_CMS_RESPONSE}.make (req, res, api)).execute
|
||||
end
|
||||
else
|
||||
(create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
do_post (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.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, api)).execute
|
||||
end
|
||||
end
|
||||
else
|
||||
do_error (req, res, l_id)
|
||||
end
|
||||
else
|
||||
(create {ERROR_500_CMS_RESPONSE}.make (req, res, api)).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.node (l_id.integer_value) as l_node then
|
||||
u_node := extract_data_form (req)
|
||||
u_node.set_id (l_id.integer_value)
|
||||
api.update_node_content (l_user.id, u_node.id, u_node.content)
|
||||
(create {CMS_GENERIC_RESPONSE}).new_response_redirect (req, res, req.absolute_script_url (""))
|
||||
else
|
||||
do_error (req, res, l_id)
|
||||
end
|
||||
else
|
||||
(create {ERROR_500_CMS_RESPONSE}.make (req, res, api)).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, api)
|
||||
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
|
||||
@@ -1,217 +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.node (l_id.integer_value) as l_node then
|
||||
create {GENERIC_VIEW_CMS_RESPONSE} l_page.make (req, res, api)
|
||||
l_page.add_variable (l_node, "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
|
||||
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.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, api)).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.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.node (l_id.integer_value) as l_node then
|
||||
u_node := extract_data_form (req)
|
||||
u_node.set_id (l_id.integer_value)
|
||||
api.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, api)).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.node (l_id.integer_value) as l_node then
|
||||
api.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, api)).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, api)
|
||||
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, api)
|
||||
l_page.add_variable (setup.is_html, "html")
|
||||
l_page.add_variable (setup.is_web, "web")
|
||||
l_page.execute
|
||||
|
||||
else
|
||||
(create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
|
||||
end
|
||||
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
|
||||
@@ -1,171 +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.node (l_id.integer_value) as l_node then
|
||||
create {GENERIC_VIEW_CMS_RESPONSE} l_page.make (req, res, api)
|
||||
l_page.add_variable (l_id.value, "id")
|
||||
l_page.add_variable (l_node.summary, "node_summary")
|
||||
l_page.execute
|
||||
else
|
||||
do_error (req, res, l_id)
|
||||
end
|
||||
else
|
||||
(create {ERROR_500_CMS_RESPONSE}.make (req, res, api)).execute
|
||||
end
|
||||
else
|
||||
(create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
do_post (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.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, api)).execute
|
||||
end
|
||||
end
|
||||
else
|
||||
do_error (req, res, l_id)
|
||||
end
|
||||
else
|
||||
(create {ERROR_500_CMS_RESPONSE}.make (req, res, api)).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.node (l_id.integer_value) as l_node then
|
||||
u_node := extract_data_form (req)
|
||||
u_node.set_id (l_id.integer_value)
|
||||
api.update_node_summary (l_user.id,u_node.id, u_node.summary)
|
||||
(create {CMS_GENERIC_RESPONSE}).new_response_redirect (req, res, req.absolute_script_url (""))
|
||||
else
|
||||
do_error (req, res, l_id)
|
||||
end
|
||||
else
|
||||
(create {ERROR_500_CMS_RESPONSE}.make (req, res, api)).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, api)
|
||||
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
|
||||
@@ -1,169 +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.node (l_id.integer_value) as l_node then
|
||||
create {GENERIC_VIEW_CMS_RESPONSE} l_page.make (req, res, api)
|
||||
l_page.add_variable (l_node.title, "node_title")
|
||||
l_page.add_variable (l_id.value, "id")
|
||||
l_page.execute
|
||||
else
|
||||
do_error (req, res, l_id)
|
||||
end
|
||||
else
|
||||
(create {ERROR_500_CMS_RESPONSE}.make (req, res, api)).execute
|
||||
end
|
||||
else
|
||||
(create {CMS_GENERIC_RESPONSE}).new_response_unauthorized (req, res)
|
||||
end
|
||||
end
|
||||
|
||||
do_post (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
-- <Precursor>
|
||||
do
|
||||
if attached current_user_name (req) as l_user then
|
||||
if attached {WSF_STRING} req.path_parameter ("id") as l_id then
|
||||
if l_id.is_integer and then attached {CMS_NODE} api.node (l_id.integer_value) as l_node then
|
||||
if 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, api)).execute
|
||||
end
|
||||
end
|
||||
else
|
||||
do_error (req, res, l_id)
|
||||
end
|
||||
else
|
||||
(create {ERROR_500_CMS_RESPONSE}.make (req, res, api)).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.node (l_id.integer_value) as l_node then
|
||||
u_node := extract_data_form (req)
|
||||
u_node.set_id (l_id.integer_value)
|
||||
api.update_node_title (l_user.id,u_node.id, u_node.title)
|
||||
(create {CMS_GENERIC_RESPONSE}).new_response_redirect (req, res, req.absolute_script_url (""))
|
||||
else
|
||||
do_error (req, res, l_id)
|
||||
end
|
||||
else
|
||||
(create {ERROR_500_CMS_RESPONSE}.make (req, res, api)).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, api)
|
||||
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
|
||||
@@ -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, api)
|
||||
l_page.add_variable (api.nodes, "nodes")
|
||||
l_page.execute
|
||||
end
|
||||
end
|
||||
@@ -1,169 +0,0 @@
|
||||
note
|
||||
description: "CMS module that bring support for NODE management."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
NODE_MODULE
|
||||
|
||||
inherit
|
||||
|
||||
CMS_MODULE
|
||||
redefine
|
||||
register_hooks
|
||||
end
|
||||
|
||||
CMS_HOOK_MENU_SYSTEM_ALTER
|
||||
|
||||
CMS_HOOK_BLOCK
|
||||
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_setup: CMS_SETUP)
|
||||
-- Create Current module, disabled by default.
|
||||
do
|
||||
name := "node"
|
||||
version := "1.0"
|
||||
description := "Service to manage content based on 'node'"
|
||||
package := "core"
|
||||
config := a_setup
|
||||
end
|
||||
|
||||
|
||||
config: CMS_SETUP
|
||||
-- Node configuration.
|
||||
|
||||
feature -- Access: router
|
||||
|
||||
router (a_api: CMS_API): WSF_ROUTER
|
||||
-- Node router.
|
||||
do
|
||||
create Result.make (5)
|
||||
configure_api_node (a_api, Result)
|
||||
configure_api_nodes (a_api, Result)
|
||||
configure_api_node_title (a_api, Result)
|
||||
configure_api_node_summary (a_api, Result)
|
||||
configure_api_node_content (a_api, Result)
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation: routes
|
||||
|
||||
configure_api_node (api: CMS_API; a_router: WSF_ROUTER)
|
||||
local
|
||||
l_node_handler: NODE_HANDLER
|
||||
l_methods: WSF_REQUEST_METHODS
|
||||
do
|
||||
create l_node_handler.make (api)
|
||||
create l_methods
|
||||
l_methods.enable_get
|
||||
l_methods.enable_post
|
||||
l_methods.enable_put
|
||||
a_router.handle_with_request_methods ("/node", l_node_handler, l_methods)
|
||||
|
||||
create l_node_handler.make (api)
|
||||
create l_methods
|
||||
l_methods.enable_get
|
||||
l_methods.enable_post
|
||||
l_methods.enable_put
|
||||
l_methods.enable_delete
|
||||
a_router.handle_with_request_methods ("/node/{id}", l_node_handler, l_methods)
|
||||
a_router.handle_with_request_methods ("/nodes/", create {WSF_URI_AGENT_HANDLER}.make (agent do_get_nodes (?,?, api)), a_router.methods_get)
|
||||
end
|
||||
|
||||
configure_api_nodes (api: CMS_API; a_router: WSF_ROUTER)
|
||||
local
|
||||
l_nodes_handler: NODES_HANDLER
|
||||
l_methods: WSF_REQUEST_METHODS
|
||||
do
|
||||
create l_nodes_handler.make (api)
|
||||
create l_methods
|
||||
l_methods.enable_get
|
||||
a_router.handle_with_request_methods ("/nodes", l_nodes_handler, l_methods)
|
||||
end
|
||||
|
||||
configure_api_node_summary (api: CMS_API; a_router: WSF_ROUTER)
|
||||
local
|
||||
l_report_handler: NODE_SUMMARY_HANDLER
|
||||
l_methods: WSF_REQUEST_METHODS
|
||||
do
|
||||
create l_report_handler.make (api)
|
||||
create l_methods
|
||||
l_methods.enable_get
|
||||
l_methods.enable_post
|
||||
l_methods.enable_put
|
||||
a_router.handle_with_request_methods ("/node/{id}/summary", l_report_handler, l_methods)
|
||||
end
|
||||
|
||||
configure_api_node_title (api: CMS_API; a_router: WSF_ROUTER)
|
||||
local
|
||||
l_report_handler: NODE_TITLE_HANDLER
|
||||
l_methods: WSF_REQUEST_METHODS
|
||||
do
|
||||
create l_report_handler.make (api)
|
||||
create l_methods
|
||||
l_methods.enable_get
|
||||
l_methods.enable_post
|
||||
l_methods.enable_put
|
||||
a_router.handle_with_request_methods ("/node/{id}/title", l_report_handler, l_methods)
|
||||
end
|
||||
|
||||
configure_api_node_content (api: CMS_API; a_router: WSF_ROUTER)
|
||||
local
|
||||
l_report_handler: NODE_CONTENT_HANDLER
|
||||
l_methods: WSF_REQUEST_METHODS
|
||||
do
|
||||
create l_report_handler.make (api)
|
||||
create l_methods
|
||||
l_methods.enable_get
|
||||
l_methods.enable_post
|
||||
l_methods.enable_put
|
||||
a_router.handle_with_request_methods ("/node/{id}/content", l_report_handler, l_methods)
|
||||
end
|
||||
|
||||
feature -- Hooks
|
||||
|
||||
register_hooks (a_response: CMS_RESPONSE)
|
||||
do
|
||||
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
|
||||
Result := <<"node-info">>
|
||||
end
|
||||
|
||||
get_block_view (a_block_id: READABLE_STRING_8; a_response: CMS_RESPONSE)
|
||||
local
|
||||
-- b: CMS_CONTENT_BLOCK
|
||||
do
|
||||
-- create b.make (a_block_id, "Block::node", "This is a block test", Void)
|
||||
-- a_response.add_block (b, "sidebar_second")
|
||||
end
|
||||
|
||||
menu_system_alter (a_menu_system: CMS_MENU_SYSTEM; a_response: CMS_RESPONSE)
|
||||
local
|
||||
lnk: CMS_LOCAL_LINK
|
||||
-- perms: detachable ARRAYED_LIST [READABLE_STRING_8]
|
||||
do
|
||||
create lnk.make ("List of nodes", a_response.url ("/nodes", Void))
|
||||
a_menu_system.primary_menu.extend (lnk)
|
||||
end
|
||||
|
||||
feature -- Handler
|
||||
|
||||
do_get_nodes (req: WSF_REQUEST; res: WSF_RESPONSE; a_api: CMS_API)
|
||||
local
|
||||
r: CMS_RESPONSE
|
||||
do
|
||||
create {NOT_IMPLEMENTED_ERROR_CMS_RESPONSE} r.make (req, res, a_api)
|
||||
r.set_main_content ("Sorry: listing the CMS nodes is not yet implemented.")
|
||||
r.add_block (create {CMS_CONTENT_BLOCK}.make ("nodes_warning", Void, "/nodes/ is not yet implemented", Void), "highlighted")
|
||||
r.execute
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,177 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {CMS_API}."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CMS_API
|
||||
|
||||
inherit
|
||||
|
||||
SHARED_ERROR
|
||||
|
||||
REFACTORING_HELPER
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature -- Initialize
|
||||
|
||||
make (a_setup: CMS_SETUP)
|
||||
-- Create the API service with an storege `a_storage'.
|
||||
do
|
||||
setup := a_setup
|
||||
create error_handler.make
|
||||
initialize
|
||||
set_successful
|
||||
ensure
|
||||
-- storage_set: storage = a_storage
|
||||
end
|
||||
|
||||
setup: CMS_SETUP
|
||||
-- CMS setup.
|
||||
|
||||
initialize
|
||||
local
|
||||
l_database: DATABASE_CONNECTION
|
||||
retried: BOOLEAN
|
||||
l_message: STRING
|
||||
do
|
||||
if not retried then
|
||||
to_implement ("Refactor database setup")
|
||||
if attached (create {JSON_CONFIGURATION}).new_database_configuration (setup.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 {CMS_STORAGE_MYSQL} storage.make (l_database)
|
||||
else
|
||||
create {DATABASE_CONNECTION_NULL} l_database.make_common
|
||||
create {CMS_STORAGE_NULL} storage
|
||||
end
|
||||
else
|
||||
to_implement ("Workaround code, persistence layer does not implement yet this kind of error handling.")
|
||||
-- error hanling.
|
||||
create {DATABASE_CONNECTION_NULL} l_database.make_common
|
||||
create {CMS_STORAGE_NULL} storage
|
||||
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
|
||||
error_handler.add_custom_error (0, " Database Connection ", l_message)
|
||||
end
|
||||
rescue
|
||||
retried := True
|
||||
retry
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
error_handler: ERROR_HANDLER
|
||||
-- Error handler.
|
||||
|
||||
feature -- Status Report
|
||||
|
||||
is_valid_credential (l_auth_login, l_auth_password: READABLE_STRING_32): BOOLEAN
|
||||
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
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {CMS_API_OPTIONS}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CMS_API_OPTIONS
|
||||
|
||||
inherit
|
||||
WSF_API_OPTIONS
|
||||
|
||||
create
|
||||
make,
|
||||
make_from_manifest
|
||||
|
||||
end
|
||||
@@ -1,58 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {CMS_REQUEST_UTIL}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
CMS_REQUEST_UTIL
|
||||
|
||||
inherit
|
||||
|
||||
CMS_ENCODERS
|
||||
|
||||
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
|
||||
@@ -1,259 +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
|
||||
rename
|
||||
execute as execute_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_api: CMS_API)
|
||||
-- Build a CMS service with `a_setup' configuration.
|
||||
do
|
||||
api := a_api
|
||||
configuration := a_api.setup.configuration
|
||||
initialize
|
||||
end
|
||||
|
||||
initialize
|
||||
-- Initialize various parts of the CMS service.
|
||||
do
|
||||
initialize_modules
|
||||
initialize_users
|
||||
initialize_auth_engine
|
||||
initialize_mailer
|
||||
initialize_router
|
||||
initialize_filter
|
||||
end
|
||||
|
||||
initialize_modules
|
||||
-- Intialize modules and keep only enabled modules.
|
||||
local
|
||||
l_module: CMS_MODULE
|
||||
l_available_modules: CMS_MODULE_COLLECTION
|
||||
do
|
||||
log.write_debug (generator + ".initialize_modules")
|
||||
l_available_modules := setup.modules
|
||||
create modules.make (l_available_modules.count)
|
||||
across
|
||||
l_available_modules as ic
|
||||
loop
|
||||
l_module := ic.item
|
||||
if l_module.is_enabled then
|
||||
modules.extend (l_module)
|
||||
end
|
||||
end
|
||||
ensure
|
||||
only_enabled_modules: across modules as ic all ic.item.is_enabled end
|
||||
end
|
||||
|
||||
initialize_users
|
||||
-- Initialize users.
|
||||
do
|
||||
end
|
||||
|
||||
initialize_mailer
|
||||
-- Initialize mailer engine.
|
||||
do
|
||||
to_implement ("To Implement mailer")
|
||||
end
|
||||
|
||||
initialize_auth_engine
|
||||
do
|
||||
to_implement ("To Implement authentication engine")
|
||||
end
|
||||
|
||||
feature -- Settings: router
|
||||
|
||||
setup_router
|
||||
-- <Precursor>
|
||||
local
|
||||
l_module: CMS_MODULE
|
||||
l_api: like api
|
||||
l_router: like router
|
||||
do
|
||||
log.write_debug (generator + ".setup_router")
|
||||
-- Configure root of api handler.
|
||||
|
||||
l_router := router
|
||||
configure_api_root (l_router)
|
||||
|
||||
-- Include routes from modules.
|
||||
l_api := api
|
||||
across
|
||||
modules as ic
|
||||
loop
|
||||
l_module := ic.item
|
||||
l_router.import (l_module.router (l_api))
|
||||
end
|
||||
-- Configure files handler.
|
||||
configure_api_file_handler (l_router)
|
||||
end
|
||||
|
||||
configure_api_root (a_router: WSF_ROUTER)
|
||||
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 (api)
|
||||
create l_methods
|
||||
l_methods.enable_get
|
||||
a_router.handle_with_request_methods ("/", l_root_handler, l_methods)
|
||||
a_router.handle_with_request_methods ("", l_root_handler, l_methods)
|
||||
end
|
||||
|
||||
configure_api_file_handler (a_router: WSF_ROUTER)
|
||||
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)
|
||||
a_router.handle_with_request_methods ("/", fhdl, router.methods_GET)
|
||||
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)
|
||||
execute_service (req, res)
|
||||
end
|
||||
|
||||
feature -- Filters
|
||||
|
||||
create_filter
|
||||
-- Create `filter'.
|
||||
local
|
||||
f, l_filter: detachable WSF_FILTER
|
||||
l_module: CMS_MODULE
|
||||
l_api: like api
|
||||
do
|
||||
log.write_debug (generator + ".create_filter")
|
||||
l_filter := Void
|
||||
|
||||
-- Maintenance
|
||||
create {WSF_MAINTENANCE_FILTER} f
|
||||
f.set_next (l_filter)
|
||||
l_filter := f
|
||||
|
||||
-- Error Filter
|
||||
create {CMS_ERROR_FILTER} f.make (api)
|
||||
f.set_next (l_filter)
|
||||
l_filter := f
|
||||
|
||||
-- Include filters from modules
|
||||
l_api := api
|
||||
across
|
||||
modules as ic
|
||||
loop
|
||||
l_module := ic.item
|
||||
if
|
||||
l_module.is_enabled and then
|
||||
attached l_module.filters (l_api) as l_m_filters
|
||||
then
|
||||
across l_m_filters as f_ic loop
|
||||
f := f_ic.item
|
||||
f.set_next (l_filter)
|
||||
l_filter := f
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
filter := l_filter
|
||||
end
|
||||
|
||||
setup_filter
|
||||
-- Setup `filter'.
|
||||
local
|
||||
f: WSF_FILTER
|
||||
do
|
||||
log.write_debug (generator + ".setup_filter")
|
||||
|
||||
from
|
||||
f := filter
|
||||
until
|
||||
not attached f.next as l_next
|
||||
loop
|
||||
f := l_next
|
||||
end
|
||||
f.set_next (Current)
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
api: CMS_API
|
||||
-- API service.
|
||||
|
||||
setup: CMS_SETUP
|
||||
-- CMS setup.
|
||||
do
|
||||
Result := api.setup
|
||||
end
|
||||
|
||||
configuration: CMS_CONFIGURATION
|
||||
-- CMS configuration.
|
||||
--| Maybe we can compute it (using `setup') instead of using memory.
|
||||
|
||||
modules: CMS_MODULE_COLLECTION
|
||||
-- Configurator of possible modules.
|
||||
|
||||
feature -- Execution
|
||||
|
||||
execute_default (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
-- Default request handler if no other are relevant
|
||||
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
|
||||
@@ -1,33 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {CMS_ERROR_FILTER}."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CMS_ERROR_FILTER
|
||||
|
||||
inherit
|
||||
|
||||
WSF_URI_TEMPLATE_HANDLER
|
||||
CMS_HANDLER
|
||||
WSF_FILTER
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature -- Basic operations
|
||||
|
||||
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
-- Execute the filter
|
||||
do
|
||||
if not api.error_handler.has_error then
|
||||
log.write_information (generator + ".execute")
|
||||
execute_next (req, res)
|
||||
else
|
||||
log.write_critical (generator + ".execute" + api.error_handler.as_string_representation )
|
||||
(create {ERROR_500_CMS_RESPONSE}.make (req, res, api)).execute
|
||||
api.error_handler.reset
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,38 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {CMS_HANDLER}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
CMS_HANDLER
|
||||
|
||||
inherit
|
||||
|
||||
WSF_HANDLER
|
||||
|
||||
CMS_REQUEST_UTIL
|
||||
|
||||
SHARED_LOGGER
|
||||
|
||||
REFACTORING_HELPER
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_api: CMS_API)
|
||||
do
|
||||
api := a_api
|
||||
end
|
||||
|
||||
feature -- Setup
|
||||
|
||||
setup: CMS_SETUP
|
||||
do
|
||||
Result := api.setup
|
||||
end
|
||||
|
||||
feature -- API Service
|
||||
|
||||
api: CMS_API
|
||||
|
||||
end
|
||||
@@ -1,61 +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=%"CMSRoc-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
|
||||
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
|
||||
@@ -1,987 +0,0 @@
|
||||
note
|
||||
description: "Generic CMS Response.It builds the content to get process to render the output"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
CMS_RESPONSE
|
||||
|
||||
inherit
|
||||
CMS_URL_UTILITIES
|
||||
|
||||
REFACTORING_HELPER
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (req: WSF_REQUEST; res: WSF_RESPONSE; a_api: like api)
|
||||
do
|
||||
status_code := {HTTP_STATUS_CODE}.ok
|
||||
api := a_api
|
||||
request := req
|
||||
response := res
|
||||
create header.make
|
||||
create values.make (3)
|
||||
initialize
|
||||
end
|
||||
|
||||
initialize
|
||||
do
|
||||
get_theme
|
||||
create menu_system.make
|
||||
initialize_block_region_settings
|
||||
register_hooks
|
||||
end
|
||||
|
||||
register_hooks
|
||||
local
|
||||
l_module: CMS_MODULE
|
||||
l_available_modules: CMS_MODULE_COLLECTION
|
||||
do
|
||||
l_available_modules := setup.modules
|
||||
across
|
||||
l_available_modules as ic
|
||||
loop
|
||||
l_module := ic.item
|
||||
if l_module.is_enabled then
|
||||
l_module.register_hooks (Current)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
request: WSF_REQUEST
|
||||
|
||||
response: WSF_RESPONSE
|
||||
|
||||
api: CMS_API
|
||||
-- Current CMS API.
|
||||
|
||||
setup: CMS_SETUP
|
||||
-- Current setup
|
||||
do
|
||||
Result := api.setup
|
||||
end
|
||||
|
||||
status_code: INTEGER
|
||||
|
||||
header: WSF_HEADER
|
||||
|
||||
title: detachable READABLE_STRING_32
|
||||
|
||||
page_title: detachable READABLE_STRING_32
|
||||
-- Page title
|
||||
|
||||
main_content: detachable STRING_8
|
||||
|
||||
additional_page_head_lines: detachable LIST [READABLE_STRING_8]
|
||||
-- HTML>head>...extra lines
|
||||
|
||||
feature -- URL utilities
|
||||
|
||||
is_front: BOOLEAN
|
||||
-- Is current response related to "front" page?
|
||||
local
|
||||
l_path_info: READABLE_STRING_8
|
||||
do
|
||||
l_path_info := request.path_info
|
||||
if attached setup.front_page_path as l_front_page_path then
|
||||
Result := l_front_page_path.same_string (l_path_info)
|
||||
else
|
||||
if attached base_url as l_base_url then
|
||||
Result := l_path_info.same_string (l_base_url)
|
||||
else
|
||||
Result := l_path_info.is_empty or else l_path_info.same_string ("/")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
site_url: READABLE_STRING_8
|
||||
do
|
||||
Result := absolute_host (request, "")
|
||||
end
|
||||
|
||||
base_url: detachable READABLE_STRING_8
|
||||
-- Base url if any.
|
||||
--| Usually it is Void, but it could be
|
||||
--| /project/demo/
|
||||
--| FIXME: for now, no way to change that. Always at the root "/"
|
||||
|
||||
feature -- Access: CMS
|
||||
|
||||
site_name: STRING_32
|
||||
do
|
||||
Result := setup.site_name
|
||||
end
|
||||
|
||||
front_page_url: READABLE_STRING_8
|
||||
do
|
||||
Result := request.absolute_script_url ("/")
|
||||
end
|
||||
|
||||
values: CMS_VALUE_TABLE
|
||||
-- Associated values indexed by string name.
|
||||
|
||||
|
||||
|
||||
feature -- Permission
|
||||
-- FIXME: to be implemented has_permissions and has_permission.
|
||||
|
||||
feature -- Status
|
||||
-- FIXME: to be implemented
|
||||
-- is_from, is_module, has_js.
|
||||
|
||||
|
||||
feature -- Head customization
|
||||
|
||||
add_additional_head_line (s: READABLE_STRING_8; a_allow_duplication: BOOLEAN)
|
||||
local
|
||||
lst: like additional_page_head_lines
|
||||
do
|
||||
lst := additional_page_head_lines
|
||||
if lst = Void then
|
||||
create {ARRAYED_LIST [like additional_page_head_lines.item]} lst.make (1)
|
||||
additional_page_head_lines := lst
|
||||
end
|
||||
if a_allow_duplication or else across lst as c all not c.item.same_string (s) end then
|
||||
lst.extend (s)
|
||||
end
|
||||
end
|
||||
|
||||
add_style (a_href: STRING; a_media: detachable STRING)
|
||||
local
|
||||
s: STRING_8
|
||||
do
|
||||
s := "<link rel=%"stylesheet%" href=%""+ a_href + "%" type=%"text/css%""
|
||||
if a_media /= Void then
|
||||
s.append (" media=%""+ a_media + "%"")
|
||||
end
|
||||
s.append ("/>")
|
||||
add_additional_head_line (s, False)
|
||||
end
|
||||
|
||||
add_javascript_url (a_src: STRING)
|
||||
local
|
||||
s: STRING_8
|
||||
do
|
||||
s := "<script type=%"text/javascript%" src=%"" + a_src + "%"></script>"
|
||||
add_additional_head_line (s, False)
|
||||
end
|
||||
|
||||
add_javascript_content (a_script: STRING)
|
||||
local
|
||||
s: STRING_8
|
||||
do
|
||||
s := "<script type=%"text/javascript%">%N" + a_script + "%N</script>"
|
||||
add_additional_head_line (s, True)
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
set_value (v: detachable ANY; k: READABLE_STRING_GENERAL)
|
||||
-- Set value `v' associated with name `k'.
|
||||
do
|
||||
values.force (v, k)
|
||||
end
|
||||
|
||||
unset_value (k: READABLE_STRING_GENERAL)
|
||||
-- Unset value associated with name `k'.
|
||||
do
|
||||
values.remove (k)
|
||||
end
|
||||
|
||||
|
||||
feature -- Logging
|
||||
|
||||
log (a_category: READABLE_STRING_8; a_message: READABLE_STRING_8; a_level: INTEGER; a_link: detachable CMS_LINK)
|
||||
local
|
||||
-- l_log: CMS_LOG
|
||||
do
|
||||
debug
|
||||
to_implement ("Add implemenatation")
|
||||
end
|
||||
-- create l_log.make (a_category, a_message, a_level, Void)
|
||||
-- if a_link /= Void then
|
||||
-- l_log.set_link (a_link)
|
||||
-- end
|
||||
-- l_log.set_info (request.http_user_agent)
|
||||
-- service.storage.save_log (l_log)
|
||||
end
|
||||
|
||||
feature -- Formats
|
||||
|
||||
formats: CMS_FORMATS
|
||||
once
|
||||
create Result
|
||||
end
|
||||
|
||||
feature -- Menu
|
||||
|
||||
menu_system: CMS_MENU_SYSTEM
|
||||
|
||||
main_menu: CMS_MENU
|
||||
obsolete
|
||||
"Use `primary_menu' [Nov/2014]"
|
||||
do
|
||||
Result := primary_menu
|
||||
end
|
||||
|
||||
primary_menu: CMS_MENU
|
||||
do
|
||||
Result := menu_system.primary_menu
|
||||
end
|
||||
|
||||
management_menu: CMS_MENU
|
||||
do
|
||||
Result := menu_system.management_menu
|
||||
end
|
||||
|
||||
navigation_menu: CMS_MENU
|
||||
do
|
||||
Result := menu_system.navigation_menu
|
||||
end
|
||||
|
||||
user_menu: CMS_MENU
|
||||
do
|
||||
Result := menu_system.user_menu
|
||||
end
|
||||
|
||||
primary_tabs: CMS_MENU
|
||||
do
|
||||
Result := menu_system.primary_tabs
|
||||
end
|
||||
|
||||
feature -- Blocks initialization
|
||||
|
||||
initialize_block_region_settings
|
||||
local
|
||||
l_table: like block_region_settings
|
||||
do
|
||||
fixme ("CHECK:Can we use the same structure as in theme.info?")
|
||||
create regions.make_caseless (5)
|
||||
|
||||
fixme ("let the user choose ...")
|
||||
create l_table.make_caseless (10)
|
||||
l_table["top"] := "top"
|
||||
l_table["header"] := "header"
|
||||
l_table["highlighted"] := "highlighted"
|
||||
l_table["help"] := "help"
|
||||
l_table["content"] := "content"
|
||||
l_table["footer"] := "footer"
|
||||
l_table["management"] := "first_sidebar"
|
||||
l_table["navigation"] := "first_sidebar"
|
||||
l_table["user"] := "first_sidebar"
|
||||
l_table["bottom"] := "page_bottom"
|
||||
block_region_settings := l_table
|
||||
end
|
||||
|
||||
feature -- Blocks regions
|
||||
|
||||
regions: STRING_TABLE [CMS_BLOCK_REGION]
|
||||
-- Layout regions, that contains blocks.
|
||||
|
||||
block_region_settings: STRING_TABLE [STRING]
|
||||
|
||||
block_region (b: CMS_BLOCK; a_default_region: detachable READABLE_STRING_8): CMS_BLOCK_REGION
|
||||
-- Region associated with block `b', or else `a_default_region' if provided.
|
||||
local
|
||||
l_region_name: detachable READABLE_STRING_8
|
||||
do
|
||||
l_region_name := block_region_settings.item (b.name)
|
||||
if l_region_name = Void then
|
||||
if a_default_region /= Void then
|
||||
l_region_name := a_default_region
|
||||
else
|
||||
-- Default .. put it in same named region
|
||||
-- Maybe a bad idea
|
||||
|
||||
l_region_name := b.name.as_lower
|
||||
end
|
||||
end
|
||||
if attached regions.item (l_region_name) as res then
|
||||
Result := res
|
||||
else
|
||||
create Result.make (l_region_name)
|
||||
regions.force (Result, l_region_name)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
feature -- Blocks
|
||||
|
||||
add_block (b: CMS_BLOCK; a_default_region: detachable READABLE_STRING_8)
|
||||
-- Add block `b' to associated region or `a_default_region' if provided.
|
||||
local
|
||||
l_region: detachable like block_region
|
||||
do
|
||||
l_region := block_region (b, a_default_region)
|
||||
l_region.extend (b)
|
||||
end
|
||||
|
||||
|
||||
get_blocks
|
||||
do
|
||||
fixme ("find a way to have this in configuration or database, and allow different order")
|
||||
add_block (top_header_block, "top")
|
||||
add_block (header_block, "header")
|
||||
if attached message_block as m then
|
||||
add_block (m, "content")
|
||||
end
|
||||
-- FIXME: avoid hardcoded html! should be only in theme.
|
||||
add_block (create {CMS_CONTENT_BLOCK}.make_raw ("top_content_anchor", Void, "<a id=%"main-content%"></a>%N", formats.full_html), "content")
|
||||
if attached page_title as l_page_title then
|
||||
-- FIXME: avoid hardcoded html! should be only in theme.
|
||||
add_block (create {CMS_CONTENT_BLOCK}.make_raw ("page_title", Void, "<h1 id=%"page-title%" class=%"title%">"+ l_page_title +"</h1>%N", formats.full_html), "content")
|
||||
end
|
||||
if attached primary_tabs_block as m then
|
||||
add_block (m, "content")
|
||||
end
|
||||
add_block (content_block, "content")
|
||||
|
||||
if attached management_menu_block as l_block then
|
||||
add_block (l_block, "first_sidebar")
|
||||
end
|
||||
if attached navigation_menu_block as l_block then
|
||||
add_block (l_block, "first_sidebar")
|
||||
end
|
||||
if attached user_menu_block as l_block then
|
||||
add_block (l_block, "first_sidebar")
|
||||
end
|
||||
|
||||
if attached footer_block as l_block then
|
||||
add_block (l_block, "footer")
|
||||
end
|
||||
|
||||
invoke_block
|
||||
end
|
||||
|
||||
primary_menu_block: detachable CMS_MENU_BLOCK
|
||||
do
|
||||
if attached primary_menu as m and then not m.is_empty then
|
||||
create Result.make (m)
|
||||
end
|
||||
end
|
||||
|
||||
management_menu_block: detachable CMS_MENU_BLOCK
|
||||
do
|
||||
if attached management_menu as m and then not m.is_empty then
|
||||
create Result.make (m)
|
||||
end
|
||||
end
|
||||
|
||||
navigation_menu_block: detachable CMS_MENU_BLOCK
|
||||
do
|
||||
if attached navigation_menu as m and then not m.is_empty then
|
||||
create Result.make (m)
|
||||
end
|
||||
end
|
||||
|
||||
user_menu_block: detachable CMS_MENU_BLOCK
|
||||
do
|
||||
if attached user_menu as m and then not m.is_empty then
|
||||
create Result.make (m)
|
||||
end
|
||||
end
|
||||
|
||||
primary_tabs_block: detachable CMS_MENU_BLOCK
|
||||
do
|
||||
if attached primary_tabs as m and then not m.is_empty then
|
||||
create Result.make (m)
|
||||
end
|
||||
end
|
||||
|
||||
top_header_block: CMS_CONTENT_BLOCK
|
||||
local
|
||||
s: STRING
|
||||
do
|
||||
create s.make_empty
|
||||
create Result.make ("page_top", Void, s, formats.full_html)
|
||||
Result.set_is_raw (True)
|
||||
end
|
||||
|
||||
header_block: CMS_CONTENT_BLOCK
|
||||
local
|
||||
s: STRING
|
||||
l_hb: STRING
|
||||
do
|
||||
create s.make_from_string (theme.menu_html (primary_menu, True))
|
||||
create l_hb.make_empty
|
||||
create Result.make ("header", Void, l_hb, formats.full_html)
|
||||
Result.set_is_raw (True)
|
||||
end
|
||||
|
||||
horizontal_primary_menu_html: STRING
|
||||
do
|
||||
create Result.make_empty
|
||||
Result.append ("<div id=%"menu-bar%">")
|
||||
Result.append (theme.menu_html (primary_menu, True))
|
||||
Result.append ("</div>")
|
||||
end
|
||||
|
||||
message_html: detachable STRING
|
||||
do
|
||||
if attached message as m and then not m.is_empty then
|
||||
Result := "<div id=%"message%">" + m + "</div>"
|
||||
end
|
||||
end
|
||||
|
||||
message_block: detachable CMS_CONTENT_BLOCK
|
||||
do
|
||||
if attached message as m and then not m.is_empty then
|
||||
create Result.make ("message", Void, "<div id=%"message%">" + m + "</div>", formats.full_html)
|
||||
Result.set_is_raw (True)
|
||||
end
|
||||
end
|
||||
|
||||
content_block: CMS_CONTENT_BLOCK
|
||||
local
|
||||
s: STRING
|
||||
do
|
||||
if attached main_content as l_content then
|
||||
s := l_content
|
||||
else
|
||||
s := ""
|
||||
debug
|
||||
s := "No Content"
|
||||
end
|
||||
end
|
||||
create Result.make ("content", Void, s, formats.full_html)
|
||||
Result.set_is_raw (True)
|
||||
end
|
||||
|
||||
made_with_html: STRING
|
||||
do
|
||||
create Result.make_empty
|
||||
Result.append ("Made with <a href=%"http://www.eiffel.com/%">EWF</a>")
|
||||
end
|
||||
|
||||
footer_block: CMS_CONTENT_BLOCK
|
||||
do
|
||||
create Result.make ("made_with", Void, made_with_html, Void)
|
||||
end
|
||||
|
||||
feature -- Hook: value alter
|
||||
|
||||
subscribe_to_value_table_alter_hook (h: like value_table_alter_hooks.item)
|
||||
local
|
||||
lst: like value_table_alter_hooks
|
||||
do
|
||||
lst := value_table_alter_hooks
|
||||
if lst = Void then
|
||||
create lst.make (1)
|
||||
value_table_alter_hooks := lst
|
||||
end
|
||||
if not lst.has (h) then
|
||||
lst.force (h)
|
||||
end
|
||||
end
|
||||
|
||||
value_table_alter_hooks: detachable ARRAYED_LIST [CMS_HOOK_VALUE_TABLE_ALTER]
|
||||
|
||||
invoke_value_table_alter (m: CMS_VALUE_TABLE)
|
||||
do
|
||||
if attached value_table_alter_hooks as lst then
|
||||
across
|
||||
lst as c
|
||||
loop
|
||||
c.item.value_table_alter (m, Current)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Hook: menu_system_alter
|
||||
|
||||
subscribe_to_menu_system_alter_hook (h: like menu_system_alter_hooks.item)
|
||||
local
|
||||
lst: like menu_system_alter_hooks
|
||||
do
|
||||
lst := menu_system_alter_hooks
|
||||
if lst = Void then
|
||||
create lst.make (1)
|
||||
menu_system_alter_hooks := lst
|
||||
end
|
||||
if not lst.has (h) then
|
||||
lst.force (h)
|
||||
end
|
||||
end
|
||||
|
||||
menu_system_alter_hooks: detachable ARRAYED_LIST [CMS_HOOK_MENU_SYSTEM_ALTER]
|
||||
|
||||
invoke_menu_system_alter (m: CMS_MENU_SYSTEM )
|
||||
do
|
||||
if attached menu_system_alter_hooks as lst then
|
||||
across
|
||||
lst as c
|
||||
loop
|
||||
c.item.menu_system_alter (m, Current)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Hook: menu_alter
|
||||
|
||||
subscribe_to_menu_alter_hook (h: like menu_alter_hooks.item)
|
||||
local
|
||||
lst: like menu_alter_hooks
|
||||
do
|
||||
lst := menu_alter_hooks
|
||||
if lst = Void then
|
||||
create lst.make (1)
|
||||
menu_alter_hooks := lst
|
||||
end
|
||||
if not lst.has (h) then
|
||||
lst.force (h)
|
||||
end
|
||||
end
|
||||
|
||||
menu_alter_hooks: detachable ARRAYED_LIST [CMS_HOOK_MENU_ALTER]
|
||||
|
||||
invoke_menu_alter (m: CMS_MENU)
|
||||
do
|
||||
if attached menu_alter_hooks as lst then
|
||||
across
|
||||
lst as c
|
||||
loop
|
||||
c.item.menu_alter (m, Current)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Hook: form_alter
|
||||
|
||||
subscribe_to_form_alter_hook (h: like form_alter_hooks.item)
|
||||
local
|
||||
lst: like form_alter_hooks
|
||||
do
|
||||
lst := form_alter_hooks
|
||||
if lst = Void then
|
||||
create lst.make (1)
|
||||
form_alter_hooks := lst
|
||||
end
|
||||
if not lst.has (h) then
|
||||
lst.force (h)
|
||||
end
|
||||
end
|
||||
|
||||
form_alter_hooks: detachable ARRAYED_LIST [CMS_HOOK_FORM_ALTER]
|
||||
|
||||
invoke_form_alter (f: CMS_FORM; a_form_data: detachable WSF_FORM_DATA)
|
||||
do
|
||||
if attached form_alter_hooks as lst then
|
||||
across
|
||||
lst as c
|
||||
loop
|
||||
c.item.form_alter (f, a_form_data, Current)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Hook: block
|
||||
|
||||
subscribe_to_block_hook (h: CMS_HOOK_BLOCK)
|
||||
local
|
||||
lst: like block_hooks
|
||||
do
|
||||
lst := block_hooks
|
||||
if lst = Void then
|
||||
create lst.make (1)
|
||||
block_hooks := lst
|
||||
end
|
||||
if not lst.has (h) then
|
||||
lst.force (h)
|
||||
end
|
||||
end
|
||||
|
||||
block_hooks: detachable ARRAYED_LIST [CMS_HOOK_BLOCK]
|
||||
|
||||
invoke_block
|
||||
do
|
||||
if attached block_hooks as lst then
|
||||
across
|
||||
lst as c
|
||||
loop
|
||||
across
|
||||
c.item.block_list as blst
|
||||
loop
|
||||
c.item.get_block_view (blst.item, Current)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Menu: change
|
||||
|
||||
add_to_main_menu (lnk: CMS_LINK)
|
||||
obsolete
|
||||
"use add_to_primary_menu [Nov/2014]"
|
||||
do
|
||||
add_to_primary_menu (lnk)
|
||||
end
|
||||
|
||||
add_to_primary_menu (lnk: CMS_LINK)
|
||||
do
|
||||
add_to_menu (lnk, primary_menu)
|
||||
end
|
||||
|
||||
add_to_menu (lnk: CMS_LINK; m: CMS_MENU)
|
||||
do
|
||||
-- if attached {CMS_LOCAL_LINK} lnk as l_local then
|
||||
-- l_local.get_is_active (request)
|
||||
-- end
|
||||
m.extend (lnk)
|
||||
end
|
||||
|
||||
feature -- Message
|
||||
|
||||
add_message (a_msg: READABLE_STRING_8; a_category: detachable READABLE_STRING_8)
|
||||
local
|
||||
m: like message
|
||||
do
|
||||
m := message
|
||||
if m = Void then
|
||||
create m.make (a_msg.count + 9)
|
||||
message := m
|
||||
end
|
||||
if a_category /= Void then
|
||||
m.append ("<li class=%""+ a_category +"%">")
|
||||
else
|
||||
m.append ("<li>")
|
||||
end
|
||||
m.append (a_msg + "</li>")
|
||||
end
|
||||
|
||||
add_notice_message (a_msg: READABLE_STRING_8)
|
||||
do
|
||||
add_message (a_msg, "notice")
|
||||
end
|
||||
|
||||
add_warning_message (a_msg: READABLE_STRING_8)
|
||||
do
|
||||
add_message (a_msg, "warning")
|
||||
end
|
||||
|
||||
add_error_message (a_msg: READABLE_STRING_8)
|
||||
do
|
||||
add_message (a_msg, "error")
|
||||
end
|
||||
|
||||
add_success_message (a_msg: READABLE_STRING_8)
|
||||
do
|
||||
add_message (a_msg, "success")
|
||||
end
|
||||
|
||||
report_form_errors (fd: WSF_FORM_DATA)
|
||||
require
|
||||
has_error: not fd.is_valid
|
||||
do
|
||||
if attached fd.errors as errs then
|
||||
across
|
||||
errs as err
|
||||
loop
|
||||
if attached err.item as e then
|
||||
if attached e.field as l_field then
|
||||
if attached e.message as e_msg then
|
||||
add_error_message (e_msg) --"Field [" + l_field.name + "] is invalid. " + e_msg)
|
||||
else
|
||||
add_error_message ("Field [" + l_field.name + "] is invalid.")
|
||||
end
|
||||
elseif attached e.message as e_msg then
|
||||
add_error_message (e_msg)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
message: detachable STRING_8
|
||||
|
||||
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)
|
||||
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
|
||||
-- Menu
|
||||
add_to_primary_menu (create {CMS_LOCAL_LINK}.make ("Home", "/"))
|
||||
invoke_menu_system_alter (menu_system)
|
||||
prepare_menu_system (menu_system)
|
||||
|
||||
-- Blocks
|
||||
get_blocks
|
||||
across
|
||||
regions as reg_ic
|
||||
loop
|
||||
across
|
||||
reg_ic.item.blocks as ic
|
||||
loop
|
||||
if attached {CMS_MENU_BLOCK} ic.item as l_menu_block then
|
||||
recursive_get_active (l_menu_block.menu, request)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Values
|
||||
common_prepare (page)
|
||||
custom_prepare (page)
|
||||
|
||||
-- Cms values
|
||||
invoke_value_table_alter (values)
|
||||
|
||||
-- Predefined values
|
||||
page.register_variable (page, "page") -- DO NOT REMOVE
|
||||
|
||||
-- Values Associated with current Execution object.
|
||||
across
|
||||
values as ic
|
||||
loop
|
||||
page.register_variable (ic.item, ic.key)
|
||||
end
|
||||
|
||||
-- Block rendering
|
||||
across
|
||||
regions as reg_ic
|
||||
loop
|
||||
across
|
||||
reg_ic.item.blocks as ic
|
||||
loop
|
||||
page.add_to_region (theme.block_html (ic.item), reg_ic.item.name)
|
||||
end
|
||||
end
|
||||
|
||||
-- Additional lines in <head ../>
|
||||
if attached additional_page_head_lines as l_head_lines then
|
||||
across
|
||||
l_head_lines as hl
|
||||
loop
|
||||
page.head_lines.force (hl.item)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
common_prepare (page: CMS_HTML_PAGE)
|
||||
-- Common preparation for page `page'.
|
||||
do
|
||||
fixme ("Fix generation common")
|
||||
|
||||
-- Information
|
||||
page.set_title (title)
|
||||
debug ("cms")
|
||||
if title = Void then
|
||||
page.set_title ("CMS::" + request.path_info) --| FIXME: probably, should be removed and handled by theme.
|
||||
end
|
||||
end
|
||||
|
||||
-- Variables
|
||||
page.register_variable (request.absolute_script_url (""), "site_url")
|
||||
page.register_variable (request.absolute_script_url (""), "host") -- Same as `site_url'.
|
||||
if attached current_user_name (request) as l_user then
|
||||
page.register_variable (l_user, "user")
|
||||
end
|
||||
page.register_variable (title, "site_title")
|
||||
page.set_is_front (is_front)
|
||||
|
||||
-- Variables/Setup
|
||||
page.register_variable (setup.is_web, "web")
|
||||
page.register_variable (setup.is_html, "html")
|
||||
|
||||
-- Variables/Misc
|
||||
|
||||
-- FIXME: logo .. could be a settings of theme, managed by admin front-end/database.
|
||||
-- if attached logo_location as l_logo then
|
||||
-- page.register_variable (l_logo, "logo")
|
||||
-- end
|
||||
|
||||
-- Menu...
|
||||
page.register_variable (horizontal_primary_menu_html, "primary_nav")
|
||||
end
|
||||
|
||||
custom_prepare (page: CMS_HTML_PAGE)
|
||||
-- Common preparation for page `page' that can be redefined by descendants.
|
||||
do
|
||||
end
|
||||
|
||||
prepare_menu_system (a_menu_system: CMS_MENU_SYSTEM)
|
||||
do
|
||||
across
|
||||
a_menu_system as c
|
||||
loop
|
||||
prepare_links (c.item)
|
||||
end
|
||||
end
|
||||
|
||||
prepare_links (a_menu: CMS_LINK_COMPOSITE)
|
||||
local
|
||||
to_remove: ARRAYED_LIST [CMS_LINK]
|
||||
do
|
||||
create to_remove.make (0)
|
||||
across
|
||||
a_menu as c
|
||||
loop
|
||||
if attached {CMS_LOCAL_LINK} c.item as lm then
|
||||
-- if attached lm.permission_arguments as perms and then not has_permissions (perms) then
|
||||
-- to_remove.force (lm)
|
||||
-- else
|
||||
-- if lm.permission_arguments is Void , this is permitted
|
||||
get_local_link_active_status (lm)
|
||||
if attached {CMS_LINK_COMPOSITE} lm as comp then
|
||||
prepare_links (comp)
|
||||
end
|
||||
-- end
|
||||
elseif attached {CMS_LINK_COMPOSITE} c.item as comp then
|
||||
prepare_links (comp)
|
||||
end
|
||||
end
|
||||
across
|
||||
to_remove as c
|
||||
loop
|
||||
a_menu.remove (c.item)
|
||||
end
|
||||
end
|
||||
|
||||
recursive_get_active (a_comp: CMS_LINK_COMPOSITE; req: WSF_REQUEST)
|
||||
-- Update the active status recursively on `a_comp'.
|
||||
local
|
||||
ln: CMS_LINK
|
||||
do
|
||||
if attached a_comp.items as l_items then
|
||||
across
|
||||
l_items as ic
|
||||
loop
|
||||
ln := ic.item
|
||||
if attached {CMS_LOCAL_LINK} ln as l_local then
|
||||
get_local_link_active_status (l_local)
|
||||
end
|
||||
if (ln.is_expanded or ln.is_collapsed) and then attached {CMS_LINK_COMPOSITE} ln as l_comp then
|
||||
recursive_get_active (l_comp, req)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
get_local_link_active_status (a_lnk: CMS_LOCAL_LINK)
|
||||
-- Get `a_lnk.is_active' value according to `request' data.
|
||||
local
|
||||
qs: STRING
|
||||
l_is_active: BOOLEAN
|
||||
do
|
||||
create qs.make_from_string (request.percent_encoded_path_info)
|
||||
l_is_active := qs.same_string (a_lnk.location)
|
||||
if not l_is_active then
|
||||
if attached request.query_string as l_query_string and then not l_query_string.is_empty then
|
||||
qs.append_character ('?')
|
||||
qs.append (l_query_string)
|
||||
end
|
||||
l_is_active := qs.same_string (a_lnk.location)
|
||||
end
|
||||
a_lnk.set_is_active (l_is_active)
|
||||
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)
|
||||
page.header.put_content_length (page.html.count)
|
||||
page.header.put_current_date
|
||||
response.send (page)
|
||||
on_terminated
|
||||
end
|
||||
|
||||
on_terminated
|
||||
do
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
@@ -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.set_status_code ({HTTP_STATUS_CODE}.internal_server_error)
|
||||
page.register_variable (page.status_code.out, "code")
|
||||
end
|
||||
|
||||
feature -- Execution
|
||||
|
||||
process
|
||||
-- Computed response message.
|
||||
do
|
||||
set_title ("Internal Server Error")
|
||||
set_page_title (Void)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {NOT_IMPLEMENTED_ERROR_CMS_RESPONSE}."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
NOT_IMPLEMENTED_ERROR_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 ("501", "code")
|
||||
page.set_status_code (501)
|
||||
end
|
||||
|
||||
feature -- Execution
|
||||
|
||||
process
|
||||
-- Computed response message.
|
||||
do
|
||||
set_title ("Not Implemented")
|
||||
set_page_title (Void)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,132 +0,0 @@
|
||||
note
|
||||
description: "Summary description for {WSF_CMS_THEME}."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
CMS_THEME
|
||||
|
||||
inherit
|
||||
CMS_ENCODERS
|
||||
|
||||
REFACTORING_HELPER
|
||||
|
||||
|
||||
feature {NONE} -- Access
|
||||
|
||||
setup: CMS_SETUP
|
||||
|
||||
feature -- Access
|
||||
|
||||
name: STRING
|
||||
-- theme name.
|
||||
deferred
|
||||
end
|
||||
|
||||
regions: ARRAY [STRING]
|
||||
-- theme's regions.
|
||||
deferred
|
||||
end
|
||||
|
||||
page_template: CMS_TEMPLATE
|
||||
-- theme template page.
|
||||
deferred
|
||||
end
|
||||
|
||||
feature -- Conversion
|
||||
|
||||
menu_html (a_menu: CMS_MENU; is_horizontal: BOOLEAN): STRING_8
|
||||
do
|
||||
fixme ("Refactor HTML code to use the new Bootstrap theme template")
|
||||
create Result.make_from_string ("<div id=%""+ a_menu.name +"%" class=%"menu%">")
|
||||
if is_horizontal then
|
||||
Result.append ("<ul class=%"horizontal%" >%N")
|
||||
else
|
||||
Result.append ("<ul class=%"vertical%" >%N")
|
||||
end
|
||||
across
|
||||
a_menu as c
|
||||
loop
|
||||
append_cms_link_to (c.item, Result)
|
||||
end
|
||||
Result.append ("</ul>%N")
|
||||
Result.append ("</div>")
|
||||
end
|
||||
|
||||
block_html (a_block: CMS_BLOCK): STRING_8
|
||||
local
|
||||
s: STRING
|
||||
do
|
||||
fixme ("Refactor HTML code to use the new Bootstrap theme template")
|
||||
if attached {CMS_CONTENT_BLOCK} a_block as l_content_block and then l_content_block.is_raw then
|
||||
create s.make_empty
|
||||
if attached l_content_block.title as l_title then
|
||||
s.append ("<div class=%"title%">" + html_encoded (l_title) + "</div>")
|
||||
end
|
||||
s.append (l_content_block.to_html (Current))
|
||||
else
|
||||
create s.make_from_string ("<div class=%"block%" id=%"" + a_block.name + "%">")
|
||||
if attached a_block.title as l_title then
|
||||
s.append ("<div class=%"title%">" + html_encoded (l_title) + "</div>")
|
||||
end
|
||||
s.append ("<div class=%"inside%">")
|
||||
s.append (a_block.to_html (Current))
|
||||
s.append ("</div>")
|
||||
s.append ("</div>")
|
||||
end
|
||||
Result := s
|
||||
end
|
||||
page_html (page: CMS_HTML_PAGE): STRING_8
|
||||
-- Render `page' as html.
|
||||
deferred
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
append_cms_link_to (lnk: CMS_LINK; s: STRING_8)
|
||||
local
|
||||
cl: STRING
|
||||
do
|
||||
fixme ("Remove HTML from Eiffel")
|
||||
create cl.make_empty
|
||||
if lnk.is_active then
|
||||
cl.append ("active ")
|
||||
end
|
||||
if lnk.is_expandable then
|
||||
cl.append ("expandable ")
|
||||
end
|
||||
if lnk.is_expanded then
|
||||
cl.append ("expanded ")
|
||||
end
|
||||
if cl.is_empty then
|
||||
s.append ("<li>")
|
||||
else
|
||||
s.append ("<li class=%""+ cl + "%">")
|
||||
end
|
||||
s.append ("<a href=%"" + (lnk.location) + "%">" + html_encoded (lnk.title) + "</a>")
|
||||
if
|
||||
(lnk.is_expanded or lnk.is_collapsed) and then
|
||||
attached lnk.children as l_children
|
||||
then
|
||||
s.append ("<ul>%N")
|
||||
across
|
||||
l_children as c
|
||||
loop
|
||||
append_cms_link_to (c.item, s)
|
||||
end
|
||||
s.append ("</ul>")
|
||||
end
|
||||
s.append ("</li>")
|
||||
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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -1,100 +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
|
||||
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
|
||||
|
||||
navigation_template: detachable READABLE_STRING_GENERAL
|
||||
-- navigation template name, if any.
|
||||
do
|
||||
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
|
||||
93
doc/concepts.md
Normal file
93
doc/concepts.md
Normal file
@@ -0,0 +1,93 @@
|
||||
CMS Concepts
|
||||
============
|
||||
>Current implemented concepts
|
||||
|
||||
##### Table of Contents
|
||||
|
||||
1. [**Theme**](#theme)
|
||||
2. [**Regions**](#regions)
|
||||
- [**Default Page Layout**](#page_layout)
|
||||
- [**Regions Holds blocks**](#regions_blocks)
|
||||
3. [**Blocks**](#blocks)
|
||||
4. [**Modules**](#modules)
|
||||
5. [**Hooks**](#hooks)
|
||||
|
||||
|
||||
<a name="theme"/>
|
||||
Theme
|
||||
-----
|
||||
In a CMS , a theme is a collection of templates files (HTML, CSS, Images, etc ) that determine how a CMS web site looks. The goal of a theme is to let you change the look and feel of the site.
|
||||
Eiffel CMS is inspired by Drupal, and use the same default region names as default drupal theme.
|
||||
|
||||
#### Important Classes
|
||||
|
||||
* [CMS_THEME] (/library/src/theme/cms_theme.e): Abstraction defining the interface of a CMS theme.
|
||||
* [SMARTY_CMS_THEME] (/library/src/theme/smarty_theme/smarty_cms_theme.e): Theme implemented using the [Eiffel Smarty library] (https://github.com/eiffelhub/template-smarty).
|
||||
* [CMS_TEMPLATE] (/library/src/theme/cms_template.e): Template Abstraction that contains theme, variables needed by template when rendering page as html. At the moment there is only one implementation SMARTY_CMS_PAGE_TEMPLATE. At the moment there is only one implementation [SMARTY_CMS_PAGE_TEMPLATE] (/library/src/theme/smarty_theme/smarty_cms_page_template.e).
|
||||
|
||||
<a name="regions"/>
|
||||
Regions
|
||||
-------
|
||||
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.
|
||||
|
||||
<a name="page_layout"/>
|
||||

|
||||
|
||||
```
|
||||
regions[page_top] = Top
|
||||
regions[header] = Header
|
||||
regions[content] = Content
|
||||
regions[highlighted] = Highlighted
|
||||
regions[help] = Help
|
||||
regions[footer] = Footer
|
||||
regions[first_sidebar] = first sidebar
|
||||
regions[second_sidebar] = second sidebar
|
||||
regions[page_bottom] = Bottom
|
||||
```
|
||||
<a name="regions_blocks"/>
|
||||
**A Region holds blocks**
|
||||
|
||||
**What goes inside regions?**
|
||||
Generally, regions hold smaller piece of content called blocks. Blocks hold chunks of content, like the user login form, navigation menu or the information for the footer.
|
||||
|
||||
Regions are defined in a configuration file theme.info.
|
||||
|
||||
|
||||
<a name="blocks"/>
|
||||
CMS_BLOCK
|
||||
---------
|
||||
**What is a cms block?**
|
||||
Blocks are chunk of content that can be created to display whatever you want, and then can be placed in various resgions in your template (theme) layout.
|
||||
|
||||
#### Important Classes
|
||||
|
||||
* [CMS_BLOCK] (/library/src/kernel/content/cms_block.e): The deferred class CMS_BLOCK provides an abstraction to describe content to be placed inside Regions.
|
||||
* [CMS_CONTENT_BLOCK] (/library/src/kernel/content/cms_content_block.e): The class CMS_CONTENT_BLOCK describe how to provide generic content.
|
||||
* [CMS_MENU_BLOCK](/library/src/kernel/content/cms_menu_block.e): The class CMS_MENU_BLOCK describe how to provides a menu of navigational links.
|
||||
* [CMS_SMARTY_TEMPLATE_BLOCK] (/library/src/kernel/content/cms_smarty_templateblock.e) The class CMS_SMARTY_TEMPLATE_BLOCK describe how to use a CMS block with smarty template file content.
|
||||
|
||||
|
||||
<a name="modules"/>
|
||||
CMS_MODULES
|
||||
-----------
|
||||
**What is a cms module?**
|
||||
Modules are piece of code that adds one or more features to your web site.
|
||||
Modules can be plugged and combined to provide a web site customized to your needs. There are modules for many purposes, for example Administratiton, Basic Authentication, etc.
|
||||
|
||||
#### Important Classes
|
||||
* [CMS_MODULE] (/library/src/modules/cms_module.e): The deferred class CMS_MODULE provides an abstraction to describe a generic module that add features to your web site.
|
||||
* [CMS_RESPONSE](/library/src/service/response/cms_response.e). The deferred class CMS_RESPONSE provide an abstraction to builds the content to get process to render the output.
|
||||
|
||||
|
||||
<a name="hooks">
|
||||
CMS_HOOK
|
||||
--------
|
||||
Hooks is a mechanism which provide a way for modules to interact with each other and extending blocks of the current CMS.
|
||||
|
||||
* [CMS_HOOK] (/library/src/hooks/cms_hook.e): The deferred class CMS_HOOK is a marker interface for CMS Hook
|
||||
* [CMS_HOOK_AUTO_REGISTER] (/library/src/hooks/cms_hook_auto_register.e): The deferred class provides an abstraction that when inheriting from this class, the declared hooks are automatically registered, otherwise, each descendant has to add it to the cms service itself.
|
||||
* [CMS_HOOK_BLOCK](/library/src/hooks/cms_hook_block.e): The class CMS_HOOK_BLOCK describe a hook providing a way to alter a generic block.
|
||||
* [CMS_HOOK_FORM_ALTER](/library/src/hooks/cms_hook_form_alter.e): The class CMS_HOOK_FORM_ATLER describe a hook providing a way to alter a form.
|
||||
* [CMS_HOOK_MENU_ALTER](/library/src/hooks/cms_hook_menu_alter.e): The class CMS_HOOK_MENU_ATLER describe a hook providing a way to alter a menu.
|
||||
* [CMS_HOOK_MENU_SYSTEM_ALTER](/library/src/hooks/cms_hook_menu_system_alter.e): The class CMS_HOOK_MENU_SYSTEM_ALTER describe a hook providing a way to alter the CMS menu system.
|
||||
* [CMS_HOOK_VALUE_TABLE_ALTER](/library/src/hooks/cms_hook_value_table_alter.e):: The class CMS_HOOK_VALUE_TABLE_ALTER describe a hook providing a way to alter the value table for a response.
|
||||
121
doc/tutorial.md
Normal file
121
doc/tutorial.md
Normal 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
|
||||
---------
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
port=8088
|
||||
#verbose=true
|
||||
@@ -1,83 +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-safe.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-safe.ecf"/>
|
||||
<library name="model" location="..\..\model\model-safe.ecf" readonly="false"/>
|
||||
<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>
|
||||
@@ -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"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
5849
examples/api/site/www/static/css/bootstrap.css
vendored
5849
examples/api/site/www/static/css/bootstrap.css
vendored
File diff suppressed because it is too large
Load Diff
@@ -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 |
@@ -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;
|
||||
});
|
||||
|
||||
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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}
|
||||
@@ -1,7 +0,0 @@
|
||||
<small>
|
||||
<center>
|
||||
<p class="text-muted"><a href="#" target="_blank" class="info">API Documentation </a>
|
||||
<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>
|
||||
@@ -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}
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
<h1>RESTonCMS</h1>
|
||||
<p>Tagline</p>
|
||||
@@ -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>
|
||||
@@ -1,5 +0,0 @@
|
||||
<!--<ul>
|
||||
<li class="main-navi-item"><a href="">Nav1</a></li>
|
||||
<li><a href="">Nav2</a></li>
|
||||
</ul>
|
||||
-->
|
||||
@@ -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}
|
||||
@@ -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}
|
||||
@@ -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>
|
||||
|
||||
|
||||
|
||||
@@ -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>
|
||||
@@ -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> </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> </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}
|
||||
@@ -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> </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}
|
||||
@@ -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> </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}
|
||||
@@ -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> </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}
|
||||
@@ -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}
|
||||
@@ -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> </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}
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -1,212 +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
|
||||
|
||||
-- Authentication
|
||||
create {AUTHENTICATION_FILTER} f.make (roc_config)
|
||||
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
|
||||
|
||||
|
||||
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
|
||||
@@ -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
|
||||
@@ -1,27 +0,0 @@
|
||||
note
|
||||
description: "CORS filter"
|
||||
date: "$Date: 2014-08-08 16:02:11 -0300 (vi., 08 ago. 2014) $"
|
||||
revision: "$Revision: 95593 $"
|
||||
|
||||
class
|
||||
CORS_FILTER
|
||||
|
||||
inherit
|
||||
WSF_FILTER
|
||||
|
||||
feature -- Basic operations
|
||||
|
||||
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
-- Execute the filter.
|
||||
local
|
||||
l_header: HTTP_HEADER
|
||||
do
|
||||
create l_header.make
|
||||
-- l_header.add_header_key_value ("Access-Control-Allow-Origin", "localhost")
|
||||
l_header.add_header_key_value ("Access-Control-Allow-Headers", "*")
|
||||
l_header.add_header_key_value ("Access-Control-Allow-Methods", "*")
|
||||
l_header.add_header_key_value ("Access-Control-Allow-Credentials", "true")
|
||||
res.put_header_lines (l_header)
|
||||
execute_next (req, res)
|
||||
end
|
||||
end
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -1,60 +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
|
||||
req.unset_execution_variable ("user")
|
||||
(create {ROC_RESPONSE}.make(req,"master2/logoff.tpl")).new_response_denied (req, res)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user