Compare commits
153 Commits
BEFORE_RES
...
es_rev9806
| Author | SHA1 | Date | |
|---|---|---|---|
| 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 |
@@ -1,5 +1,5 @@
|
||||
<?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"/>
|
||||
<file_rule>
|
||||
@@ -12,15 +12,18 @@
|
||||
</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="config" location=".\library\configuration\config-safe.ecf"/>
|
||||
<library name="crypto" location="$ISE_LIBRARY\unstable\library\text\encryption\crypto\crypto-safe.ecf"/>
|
||||
<library name="encoder" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\text\encoder\encoder-safe.ecf" readonly="false"/>
|
||||
<library name="error" location="$ISE_LIBRARY\contrib\library\utility\general\error\error-safe.ecf"/>
|
||||
<library name="http" location="$ISE_LIBRARY\contrib\library\network\protocol\http\http-safe.ecf"/>
|
||||
<library name="i18n" location="$ISE_LIBRARY\library\i18n\i18n-safe.ecf"/>
|
||||
<library name="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json-safe.ecf" readonly="false"/>
|
||||
<library name="kmp_matcher" location="$ISE_LIBRARY\library\text\regexp\kmp_matcher\kmp_matcher-safe.ecf"/>
|
||||
<library name="net" location="$ISE_LIBRARY\library\net\net-safe.ecf"/>
|
||||
<library name="notification_mailer" location="$ISE_LIBRARY\contrib\library\runtime\process\notification_email\notification_email-safe.ecf"/>
|
||||
<library name="smarty" location="$ISE_LIBRARY\contrib\library\text\template\smarty\smarty-safe.ecf" readonly="false"/>
|
||||
<library name="text_filter" location="$ISE_LIBRARY\unstable\library\text\text_filter\text_filter-safe.ecf"/>
|
||||
@@ -29,7 +32,6 @@
|
||||
<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="net" location="$ISE_LIBRARY\library\net\net-safe.ecf"/>
|
||||
<cluster name="src" location=".\src\" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
|
||||
6
cms.ecf
6
cms.ecf
@@ -13,15 +13,18 @@
|
||||
</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="config" location=".\library\configuration\config.ecf"/>
|
||||
<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"/>
|
||||
@@ -30,7 +33,6 @@
|
||||
<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"/>
|
||||
<library name="net" location="$ISE_LIBRARY\library\net\net.ecf"/>
|
||||
<cluster name="src" location=".\src\" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
<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="demo" uuid="3643E657-BCBE-46AA-931B-71EAEA877A18" library_target="demo">
|
||||
<description>Example/demo for Eiffel ROC CMS library</description>
|
||||
<target name="common" abstract="true">
|
||||
<root class="DEMO_CMS_SERVER" feature="make_and_launch"/>
|
||||
<file_rule>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
<exclude>/CVS$</exclude>
|
||||
@@ -12,41 +13,50 @@
|
||||
</option>
|
||||
<setting name="concurrency" value="thread"/>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||
<library name="cms" location="..\..\cms-safe.ecf" readonly="false"/>
|
||||
<library name="cms" location="..\..\cms-safe.ecf" readonly="false">
|
||||
<option>
|
||||
<assertions precondition="true" postcondition="true" supplier_precondition="true"/>
|
||||
</option>
|
||||
</library>
|
||||
<library name="cms_admin_module" location="..\..\modules\admin\admin-safe.ecf" readonly="false"/>
|
||||
<library name="cms_app_env" location="..\..\library\app_env\app_env-safe.ecf" readonly="false"/>
|
||||
<library name="cms_auth_module" location="..\..\modules\auth\auth-safe.ecf" readonly="false"/>
|
||||
<library name="cms_oauth_20_module" location="..\..\modules\oauth20\oauth20-safe.ecf" readonly="false"/>
|
||||
<library name="cms_basic_auth_module" location="..\..\modules\basic_auth\basic_auth-safe.ecf" readonly="false"/>
|
||||
<library name="cms_blog_module" location="modules\blog\cms_blog_module-safe.ecf" readonly="false"/>
|
||||
<library name="cms_blog_module" location="..\..\modules\blog\cms_blog_module-safe.ecf" readonly="false"/>
|
||||
<library name="cms_demo_module" location="modules\demo\cms_demo_module-safe.ecf" readonly="false"/>
|
||||
<library name="cms_email_service" location="..\..\library\email\email-safe.ecf" readonly="false"/>
|
||||
<library name="cms_feed_aggregator_module" location="..\..\modules\feed_aggregator\feed_aggregator-safe.ecf" readonly="false"/>
|
||||
<library name="cms_google_search_module" location="..\..\modules\google_search\google_search-safe.ecf" readonly="false" use_application_options="true"/>
|
||||
<library name="cms_model" location="..\..\library\model\cms_model-safe.ecf" readonly="false"/>
|
||||
<library name="cms_node_module" location="..\..\modules\node\node-safe.ecf" readonly="false"/>
|
||||
<library name="cms_oauth_20_module" location="..\..\modules\oauth20\oauth20-safe.ecf" readonly="false"/>
|
||||
<library name="cms_openid_module" location="..\..\modules\openid\openid-safe.ecf" readonly="false"/>
|
||||
<library name="cms_recent_changes_module" location="..\..\modules\recent_changes\recent_changes-safe.ecf" readonly="false"/>
|
||||
|
||||
<library name="persistence_sqlite3" location="..\..\library\persistence\sqlite3\sqlite3-safe.ecf" readonly="false">
|
||||
<option>
|
||||
<assertions/>
|
||||
</option>
|
||||
</library>
|
||||
<library name="persistence_store_odbc" location="..\..\library\persistence\store_odbc\store_odbc-safe.ecf" />
|
||||
<!--
|
||||
<library name="persistence_store_mysql" location="..\..\library\persistence\store_mysql\store_mysql-safe.ecf" readonly="false"/>
|
||||
<library name="persistence_store_mysql" location="..\..\library\persistence\store_mysql\store_mysql-safe.ecf" />
|
||||
-->
|
||||
<library name="persistence_store_odbc" location="..\..\library\persistence\store_odbc\store_odbc-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="demo_any" extends="common">
|
||||
<root class="EWF_ROC_SERVER" feature="make_and_launch"/>
|
||||
<setting name="concurrency" value="thread"/>
|
||||
<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"/>
|
||||
<library name="standalone" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\connector\standalone-safe.ecf"/>
|
||||
<cluster name="launcher" location=".\launcher\any\" recursive="true"/>
|
||||
<library name="any_launcher" location="..\..\launcher\any-safe.ecf" readonly="false"/>
|
||||
<cluster name="src" location=".\src\" recursive="true"/>
|
||||
</target>
|
||||
<target name="demo_standalone" extends="common">
|
||||
<root class="EWF_ROC_SERVER" feature="make_and_launch"/>
|
||||
<option debug="true">
|
||||
<debug name="dbglog" enabled="true"/>
|
||||
</option>
|
||||
<setting name="concurrency" value="thread"/>
|
||||
<setting name="concurrency" value="scoop"/>
|
||||
<variable name="httpd_ssl_disabled" value="true"/>
|
||||
<library name="default_standalone" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\default\standalone-safe.ecf"/>
|
||||
<cluster name="launcher" location=".\launcher\default\" recursive="true"/>
|
||||
<library name="standalone_launcher" location="..\..\launcher\standalone-safe.ecf" readonly="false"/>
|
||||
<cluster name="src" location=".\src\" recursive="true"/>
|
||||
</target>
|
||||
<target name="demo_standalone_none" extends="demo_standalone">
|
||||
@@ -58,25 +68,14 @@
|
||||
<target name="demo_standalone_scoop" extends="demo_standalone">
|
||||
<setting name="concurrency" value="scoop"/>
|
||||
</target>
|
||||
<target name="demo_nino" extends="common">
|
||||
<root class="EWF_ROC_SERVER" feature="make_and_launch"/>
|
||||
<setting name="concurrency" value="none"/>
|
||||
<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="demo_cgi" extends="common">
|
||||
<root class="EWF_ROC_SERVER" feature="make_and_launch"/>
|
||||
<setting name="concurrency" value="none"/>
|
||||
<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"/>
|
||||
<library name="cgi_launcher" location="..\..\launcher\cgi-safe.ecf" readonly="false"/>
|
||||
<cluster name="src" location=".\src\" recursive="true"/>
|
||||
</target>
|
||||
<target name="demo_libfcgi" extends="common">
|
||||
<root class="EWF_ROC_SERVER" feature="make_and_launch"/>
|
||||
<setting name="concurrency" value="none"/>
|
||||
<library name="default_libfcgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\default\libfcgi-safe.ecf"/>
|
||||
<cluster name="launcher" location=".\launcher\default\" recursive="true"/>
|
||||
<library name="libfcgi_launcher" location="..\..\launcher\libfcgi-safe.ecf" readonly="false"/>
|
||||
<cluster name="src" location=".\src\" recursive="true"/>
|
||||
</target>
|
||||
<target name="demo" extends="demo_standalone">
|
||||
|
||||
14
examples/demo/install_modules.bat
Normal file
14
examples/demo/install_modules.bat
Normal file
@@ -0,0 +1,14 @@
|
||||
setlocal
|
||||
set ROC_CMD=call %~dp0..\..\tools\roc.bat
|
||||
set ROC_CMS_DIR=%~dp0
|
||||
|
||||
%ROC_CMD% install --module ..\..\modules\admin --dir %ROC_CMS_DIR%
|
||||
%ROC_CMD% install --module ..\..\modules\auth --dir %ROC_CMS_DIR%
|
||||
%ROC_CMD% install --module ..\..\modules\basic_auth --dir %ROC_CMS_DIR%
|
||||
%ROC_CMD% install --module ..\..\modules\blog --dir %ROC_CMS_DIR%
|
||||
%ROC_CMD% install --module ..\..\modules\node --dir %ROC_CMS_DIR%
|
||||
%ROC_CMD% install --module ..\..\modules\oauth20 --dir %ROC_CMS_DIR%
|
||||
%ROC_CMD% install --module ..\..\modules\openid --dir %ROC_CMS_DIR%
|
||||
%ROC_CMD% install --module ..\..\modules\recent_changes --dir %ROC_CMS_DIR%
|
||||
%ROC_CMD% install --module ..\..\modules\feed_aggregator --dir %ROC_CMS_DIR%
|
||||
%ROC_CMD% install --module ..\..\modules\google_search --dir %ROC_CMS_DIR%
|
||||
@@ -1,115 +0,0 @@
|
||||
note
|
||||
description: "Storage extension for Blog nodes."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CMS_NODE_STORAGE_SQL_BLOG_EXTENSION
|
||||
|
||||
inherit
|
||||
CMS_NODE_STORAGE_EXTENSION [CMS_BLOG]
|
||||
|
||||
CMS_PROXY_STORAGE_SQL
|
||||
rename
|
||||
sql_storage as node_storage
|
||||
redefine
|
||||
node_storage
|
||||
end
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
node_storage: CMS_NODE_STORAGE_SQL
|
||||
-- <Precursor>
|
||||
|
||||
feature -- Access
|
||||
|
||||
content_type: STRING
|
||||
once
|
||||
Result := {CMS_BLOG_NODE_TYPE}.name
|
||||
end
|
||||
|
||||
feature -- Persistence
|
||||
|
||||
store (a_node: CMS_BLOG)
|
||||
local
|
||||
l_parameters: STRING_TABLE [detachable ANY]
|
||||
l_new_tags: detachable STRING_32
|
||||
l_previous_tags: detachable STRING_32
|
||||
l_update: BOOLEAN
|
||||
do
|
||||
error_handler.reset
|
||||
if attached api as l_api then
|
||||
l_api.logger.put_information (generator + ".store", Void)
|
||||
end
|
||||
|
||||
create l_parameters.make (2)
|
||||
l_parameters.put (a_node.id, "nid")
|
||||
l_parameters.put (a_node.revision, "revision")
|
||||
|
||||
sql_query (sql_select_blog_data, l_parameters)
|
||||
if not has_error then
|
||||
if sql_rows_count = 1 then
|
||||
l_previous_tags := sql_read_string_32 (3)
|
||||
l_update := True
|
||||
end
|
||||
if attached a_node.tags as l_tags and then not l_tags.is_empty then
|
||||
create l_new_tags.make (0)
|
||||
across
|
||||
l_tags as ic
|
||||
loop
|
||||
if not l_new_tags.is_empty then
|
||||
l_new_tags.append_character (',')
|
||||
end
|
||||
l_new_tags.append (ic.item)
|
||||
end
|
||||
else
|
||||
l_new_tags := Void
|
||||
end
|
||||
l_parameters.put (l_new_tags, "tags")
|
||||
if l_update and l_new_tags /~ l_previous_tags then
|
||||
sql_change (sql_update_blog_data, l_parameters)
|
||||
elseif l_new_tags /= Void then
|
||||
sql_change (sql_insert_blog_data, l_parameters)
|
||||
else
|
||||
-- no blog data, means everything is empty.
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
load (a_node: CMS_BLOG)
|
||||
local
|
||||
l_parameters: STRING_TABLE [ANY]
|
||||
n: INTEGER
|
||||
do
|
||||
error_handler.reset
|
||||
create l_parameters.make (2)
|
||||
l_parameters.put (a_node.id, "nid")
|
||||
l_parameters.put (a_node.revision, "revision")
|
||||
sql_query (sql_select_blog_data, l_parameters)
|
||||
if not has_error then
|
||||
n := sql_rows_count
|
||||
if n = 1 then
|
||||
-- nid, revision, parent
|
||||
if
|
||||
attached sql_read_string_32 (3) as l_tags and then
|
||||
not l_tags.is_whitespace
|
||||
then
|
||||
-- FIXME: find a simple way to access the declared content types.
|
||||
a_node.set_tags_from_string (l_tags)
|
||||
end
|
||||
else
|
||||
check unique_data: n = 0 end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
feature -- SQL
|
||||
|
||||
sql_select_blog_data: STRING = "SELECT nid, revision, tags FROM blog_post_nodes WHERE nid =:nid AND revision=:revision;"
|
||||
sql_insert_blog_data: STRING = "INSERT INTO blog_post_nodes (nid, revision, tags) VALUES (:nid, :revision, :tags);"
|
||||
sql_update_blog_data: STRING = "UPDATE blog_post_nodes SET nid=:nid, revision=:revision, tags=:tags WHERE nid=:nid AND revision=:revision;"
|
||||
|
||||
end
|
||||
@@ -12,7 +12,6 @@ inherit
|
||||
redefine
|
||||
register_hooks,
|
||||
initialize,
|
||||
is_installed,
|
||||
install
|
||||
end
|
||||
|
||||
@@ -52,12 +51,6 @@ feature {CMS_API} -- Module Initialization
|
||||
|
||||
feature {CMS_API} -- Module management
|
||||
|
||||
is_installed (api: CMS_API): BOOLEAN
|
||||
-- Is Current module installed?
|
||||
do
|
||||
Result := attached api.storage.custom_value ("is_initialized", "module-" + name) as v and then v.is_case_insensitive_equal_general ("yes")
|
||||
end
|
||||
|
||||
install (api: CMS_API)
|
||||
local
|
||||
sql: STRING
|
||||
@@ -77,7 +70,7 @@ CREATE TABLE tb_demo(
|
||||
api.logger.put_error ("Could not initialize database for demo module", generating_type)
|
||||
end
|
||||
end
|
||||
api.storage.set_custom_value ("is_initialized", "module-" + name, "yes")
|
||||
Precursor {CMS_MODULE}(api)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -94,13 +87,13 @@ 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)
|
||||
a_response.hooks.subscribe_to_menu_system_alter_hook (Current)
|
||||
a_response.hooks.subscribe_to_block_hook (Current)
|
||||
end
|
||||
|
||||
block_list: ITERABLE [like {CMS_BLOCK}.name]
|
||||
do
|
||||
Result := <<"demo-info">>
|
||||
Result := <<"?demo-info">>
|
||||
end
|
||||
|
||||
get_block_view (a_block_id: READABLE_STRING_8; a_response: CMS_RESPONSE)
|
||||
@@ -110,8 +103,8 @@ feature -- Hooks
|
||||
m: CMS_MENU
|
||||
lnk: CMS_LOCAL_LINK
|
||||
do
|
||||
if a_block_id.is_case_insensitive_equal_general ("demo-info") then
|
||||
if a_response.request.request_uri.starts_with ("/demo/") then
|
||||
if a_block_id.same_string ("demo-info") then
|
||||
if a_response.location.starts_with_general ("demo/") then
|
||||
create m.make_with_title (a_block_id, "Demo", 2)
|
||||
create lnk.make ("demo: abc", "demo/abc")
|
||||
m.extend (lnk)
|
||||
@@ -140,7 +133,7 @@ feature -- Handler
|
||||
r: NOT_IMPLEMENTED_ERROR_CMS_RESPONSE
|
||||
do
|
||||
create r.make (req, res, a_api)
|
||||
r.set_main_content ("DEMO module does not yet implement %"" + req.path_info + "%" ...")
|
||||
r.set_main_content ("DEMO module does not yet implement %"" + req.percent_encoded_path_info + "%" ...")
|
||||
r.add_error_message ("DEMO Module: not yet implemented")
|
||||
r.execute
|
||||
end
|
||||
|
||||
38
examples/demo/site/config/blocks.ini
Normal file
38
examples/demo/site/config/blocks.ini
Normal file
@@ -0,0 +1,38 @@
|
||||
### Blocks settings
|
||||
|
||||
#navigation.region=sidebar_first
|
||||
#navigation.condition=is_front
|
||||
management.conditions[]=path:admin*
|
||||
management.conditions[]=is_front
|
||||
|
||||
#Feeds
|
||||
feed.news.weight=3
|
||||
feed.news.region=feed_news
|
||||
feed.news.region=content
|
||||
feed.news.condition=<none>
|
||||
feed.forum.weight=2
|
||||
feed.forum.region=feed_forum
|
||||
feed.forum.region=<none>
|
||||
feed.forum.condition=<none>
|
||||
feed.forum.options[size]=15
|
||||
|
||||
#Updates
|
||||
recent_changes.region=content
|
||||
recent_changes.condition=is_front
|
||||
recent_changes.title=Updates
|
||||
recent_changes.options[size]=3
|
||||
|
||||
#Aliases
|
||||
&aliases[foo]=management
|
||||
&aliases[bar]=feed.forum
|
||||
|
||||
foo.region=content
|
||||
foo.condition=is_front
|
||||
foo.weight=-10
|
||||
|
||||
bar.region=content
|
||||
bar.condition=is_front
|
||||
bar.title=Bar
|
||||
|
||||
|
||||
|
||||
@@ -9,6 +9,22 @@ email=your@email.com
|
||||
theme=bootstrap
|
||||
|
||||
[mailer]
|
||||
smtp=localhost:25
|
||||
#smtp=localhost:25
|
||||
#sendmail=/usr/bin/sendmail
|
||||
#output=@stderr
|
||||
output=@stderr
|
||||
|
||||
[modules]
|
||||
# Module status
|
||||
# *=on -> modules are enabled by default
|
||||
# *=off -> modules are disabled by default
|
||||
# Default is "on"
|
||||
# for each module, this can be overwritten with
|
||||
# module_name= on or off
|
||||
*=all
|
||||
|
||||
[blocks]
|
||||
@include=blocks.ini
|
||||
|
||||
[admin]
|
||||
# CMS Installation, are accessible by "all", "none" or uppon "permission". (default is none)
|
||||
installation_access=all
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
{
|
||||
"database": {
|
||||
"datasource": {
|
||||
"driver": "odbc",
|
||||
"environment": "odbc-sqlite"
|
||||
"driver": "sqlite3",
|
||||
"environment": "sqlite3",
|
||||
"-driver": "odbc",
|
||||
"-environment": "odbc-sqlite"
|
||||
},
|
||||
"environments": {
|
||||
"sqlite3": {
|
||||
"connection_string":"Database=./site/database.sqlite3;"
|
||||
},
|
||||
"odbc-sqlite": {
|
||||
"connection_string":"Driver=SQLite3 ODBC Driver;Database=./site/database.sqlite;LongNames=0;Timeout=1000;NoTXN=0;SyncPragma=NORMAL;StepAPI=0;"
|
||||
},
|
||||
|
||||
34
examples/demo/site/modules/admin/files/css/admin.css
Normal file
34
examples/demo/site/modules/admin/files/css/admin.css
Normal file
@@ -0,0 +1,34 @@
|
||||
ul.cms-users {
|
||||
list-style-type: none;
|
||||
padding: 3px 3px 3px 3px;
|
||||
border: solid 1px #ccc; }
|
||||
ul.cms-users li {
|
||||
border-top: dotted 1px #ccc; }
|
||||
ul.cms-users li:first-child {
|
||||
border-top: none; }
|
||||
ul.cms-users li.cms_user a::before {
|
||||
content: "[users] "; }
|
||||
|
||||
ul.cms-roles {
|
||||
list-style-type: none;
|
||||
padding: 3px 3px 3px 3px;
|
||||
border: solid 1px #ccc; }
|
||||
ul.cms-roles li {
|
||||
border-top: dotted 1px #ccc; }
|
||||
ul.cms-roles li:first-child {
|
||||
border-top: none; }
|
||||
ul.cms-roles li.cms_role a::before {
|
||||
content: "[roles] "; }
|
||||
|
||||
ul.cms-permissions {
|
||||
list-style-type: none;
|
||||
padding: 3px 3px 3px 3px;
|
||||
border: solid 1px #ccc; }
|
||||
ul.cms-permissions li {
|
||||
border-top: dotted 1px #ccc; }
|
||||
ul.cms-permissions li:first-child {
|
||||
border-top: none; }
|
||||
ul.cms-permissions li.cms_permission a::before {
|
||||
content: "[permission] "; }
|
||||
|
||||
/*# sourceMappingURL=admin.css.map */
|
||||
59
examples/demo/site/modules/admin/files/scss/admin.scss
Normal file
59
examples/demo/site/modules/admin/files/scss/admin.scss
Normal file
@@ -0,0 +1,59 @@
|
||||
ul.cms-users {
|
||||
|
||||
list-style-type: none;
|
||||
padding: 3px 3px 3px 3px;
|
||||
border: solid 1px #ccc;
|
||||
|
||||
li{
|
||||
border-top: dotted 1px #ccc;
|
||||
&:first-child {
|
||||
border-top: none;
|
||||
}
|
||||
}
|
||||
|
||||
li.cms_user a::before {
|
||||
content: "[users] ";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ul.cms-roles {
|
||||
|
||||
list-style-type: none;
|
||||
padding: 3px 3px 3px 3px;
|
||||
border: solid 1px #ccc;
|
||||
|
||||
li{
|
||||
border-top: dotted 1px #ccc;
|
||||
&:first-child {
|
||||
border-top: none;
|
||||
}
|
||||
}
|
||||
|
||||
li.cms_role a::before {
|
||||
content: "[roles] ";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ul.cms-permissions {
|
||||
|
||||
list-style-type: none;
|
||||
padding: 3px 3px 3px 3px;
|
||||
border: solid 1px #ccc;
|
||||
|
||||
li{
|
||||
border-top: dotted 1px #ccc;
|
||||
&:first-child {
|
||||
border-top: none;
|
||||
}
|
||||
}
|
||||
|
||||
li.cms_permission a::before {
|
||||
content: "[permission] ";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<p>You have required a new password at <a href="...">ROC CMS</a></p>
|
||||
<p>You have required a new password at <a href="$host">ROC CMS</a></p>
|
||||
|
||||
<p>To complete your request, please click on this link to genereate a new password:<p>
|
||||
|
||||
<p><a href="$link">$link</a></p>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<p>You have request a new activation token at<a href="...">ROC CMS</a></p>
|
||||
<p>You have request a new activation token at <a href="$host">ROC CMS</a></p>
|
||||
|
||||
<p>To complete your registration, please click on this link to activate your account:<p>
|
||||
|
||||
<p><a href="$link">$link</a></p>
|
||||
<p>Thank you for joining us.</p>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<meta name="author" content="ROC CMS">
|
||||
</head>
|
||||
<body>
|
||||
<p>Welcome to<a href="...">ROC CMS</a></p>
|
||||
<p>Welcome to<a href="$host">ROC CMS</a></p>
|
||||
<p>Thank you for joining us.</p>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"api_secret":"ADD_YOUR_SECRET_KEY",
|
||||
"api_key":"ADD_YOUR_PUBLIC_KEY",
|
||||
"scope": "email",
|
||||
"api_revoke":"https://accounts.google.com/o/oauth2/revoke?token=$ACCESS_TOKEN",
|
||||
"protected_resource_url":"https://www.googleapis.com/plus/v1/people/me"
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
<div class="primary-tabs">
|
||||
{if isset="$user"}
|
||||
<h3>Account Information</h3>
|
||||
<div>
|
||||
<div>
|
||||
<div>
|
||||
<label>Username:</label> {$user.name/}
|
||||
</div>
|
||||
<div>
|
||||
<label>Email:</label> {$user.email/}
|
||||
</div>
|
||||
<div>
|
||||
<label>Creation Date:</label> {$user.creation_date/}
|
||||
</div>
|
||||
<div>
|
||||
<label>Last login:</label> {$user.last_login_date/}
|
||||
</div>
|
||||
<div>
|
||||
<form method="get" action="{$site_url/}{$auth_login_strategy/}">
|
||||
<button type="submit">Logout</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
{include file="block_change_password.tpl" /}
|
||||
<hr>
|
||||
<h4>Roles</h4>
|
||||
<div>
|
||||
{foreach item="ic" from="$roles"}
|
||||
<div>
|
||||
<ul>
|
||||
<li>
|
||||
<strong>{$ic.name/}</strong>
|
||||
<ul>
|
||||
<li> <i>permissions</i>
|
||||
<ul>
|
||||
{foreach item="ip" from="$ic.permissions"}
|
||||
<li>{$ip/}</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
{/foreach}
|
||||
</div>
|
||||
|
||||
|
||||
<hr>
|
||||
<h4>Profile</h4>
|
||||
<div>
|
||||
{foreach item="the_value" key="the_name" from="$user.profile"}
|
||||
<div>
|
||||
<label>{$the_name/}:</label> {$the_value/}
|
||||
</div>
|
||||
{/foreach}
|
||||
</div>
|
||||
{/if}
|
||||
{unless isset="$user"}
|
||||
<div>
|
||||
<p> You are not logged in </p>
|
||||
<a href="{$site_url/}account/roc-login">Go to the login page</a>
|
||||
</div>
|
||||
{/unless}
|
||||
</div>
|
||||
@@ -0,0 +1,21 @@
|
||||
<div>
|
||||
<form action="{$site_url/}account/change-password" method="post">
|
||||
<fieldset>
|
||||
<legend>Change Password Form</legend>
|
||||
<div>
|
||||
<input type="password" id="password" name="password" value="" required/>
|
||||
<label for="password">Password</label>
|
||||
</div>
|
||||
<div>
|
||||
<input type="password" id="confirm_password" name="confirm_password" value="" required/>
|
||||
<label for="password">Confirm Password</label>
|
||||
</div>
|
||||
|
||||
<button type="submit">Confirm</button>
|
||||
{if isset="$error_password"}
|
||||
<span><i>{$error_password/}</i></span> <br>
|
||||
{/if}
|
||||
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
@@ -25,10 +25,5 @@
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
{foreach item="item" from="$oauth_consumers"}
|
||||
<a href="{$site_url/}account/login-with-oauth/{$item/}">Login with {$item/}</a><br>
|
||||
{/foreach}
|
||||
</div>
|
||||
{/unless}
|
||||
</div>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<div>
|
||||
<form action="/account/new-password" method="post">
|
||||
<form action="{$site_url/}account/new-password" method="post">
|
||||
<fieldset>
|
||||
<legend>Require new password</legend>
|
||||
<legend>Request new password by email</legend>
|
||||
<div>
|
||||
<input type="email" id="email" name="email" value="{$email/}" required/>
|
||||
<label for="email">Email</label>
|
||||
@@ -13,4 +13,20 @@
|
||||
<button type="submit">Send</button>
|
||||
</fieldset>
|
||||
</form>
|
||||
<hr>
|
||||
<form action="{$site_url/}account/new-password" method="post">
|
||||
<fieldset>
|
||||
<legend>Request new password by username</legend>
|
||||
<div>
|
||||
<input type="text" id="username" name="username" value="{$username/}" required/>
|
||||
<label for="username">Username</label>
|
||||
{if isset="$error_username"}
|
||||
<span><i>{$error_username/}</i></span> <br>
|
||||
{/if}
|
||||
<br>
|
||||
</div>
|
||||
<button type="submit">Send</button>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
<div>
|
||||
<p>You new password has been saved!, Login again</p>
|
||||
</div>
|
||||
@@ -1,5 +1,5 @@
|
||||
<div>
|
||||
<form action="/account/reactivate" method="post">
|
||||
<form action="{$site_url/}account/reactivate" method="post">
|
||||
<fieldset>
|
||||
<legend>Reactivate Form</legend>
|
||||
<div>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<div>
|
||||
<form action="/account/roc-register" method="post">
|
||||
<form action="{$site_url/}account/roc-register" method="post">
|
||||
<fieldset>
|
||||
<legend>Register Form</legend>
|
||||
<div>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<div>
|
||||
<form action="/account/reset-password" method="post">
|
||||
<form action="{$site_url/}account/reset-password" method="post">
|
||||
<fieldset>
|
||||
<legend>Generate New Password Form</legend>
|
||||
<div>
|
||||
|
||||
@@ -7,7 +7,7 @@ var userAgent = navigator.userAgent.toLowerCase();
|
||||
var firstLogIn = true;
|
||||
|
||||
ROC_AUTH.login = function() {
|
||||
var form = document.forms[0];
|
||||
var form = document.forms['cms_basic_auth'];
|
||||
var username = form.username.value;
|
||||
var password = form.password.value;
|
||||
//var host = form.host.value;
|
||||
@@ -25,7 +25,7 @@ ROC_AUTH.login = function() {
|
||||
var newdiv = document.createElement('div');
|
||||
newdiv.innerHTML = "<br>Invalid Credentials</br>";
|
||||
newdiv.id = 'myModalFormId';
|
||||
$("body").append(newdiv);
|
||||
$(".primary-tabs").append(newdiv);
|
||||
}
|
||||
}else{
|
||||
|
||||
@@ -39,7 +39,7 @@ ROC_AUTH.login = function() {
|
||||
if (request.readyState == 4) {
|
||||
if (request.status==200) {
|
||||
delete form;
|
||||
window.location=origin;
|
||||
window.location=window.location.origin;
|
||||
}
|
||||
else{
|
||||
if (navigator.userAgent.toLowerCase().indexOf("firefox") != -1){
|
||||
@@ -49,7 +49,7 @@ ROC_AUTH.login = function() {
|
||||
var newdiv = document.createElement('div');
|
||||
newdiv.innerHTML = "<br>Invalid Credentials</br>";
|
||||
newdiv.id = 'myModalFormId';
|
||||
$("body").append(newdiv);
|
||||
$(".primary-tabs").append(newdiv);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -93,7 +93,7 @@ ROC_AUTH.login_with_redirect = function() {
|
||||
var newdiv = document.createElement('div');
|
||||
newdiv.innerHTML = "<br>Invalid Credentials</br>";
|
||||
newdiv.id = 'myModalFormId';
|
||||
$("body").append(newdiv);
|
||||
$(".primary-tabs").append(newdiv);
|
||||
$("#imgProgressRedirect").hide();
|
||||
}
|
||||
}else{
|
||||
@@ -122,8 +122,8 @@ ROC_AUTH.login_with_redirect = function() {
|
||||
var newdiv = document.createElement('div');
|
||||
newdiv.innerHTML = "<br>Invalid Credentials</br>";
|
||||
newdiv.id = 'myModalFormId';
|
||||
$("body").append(newdiv);
|
||||
$("#imgProgressRedirect").hide();
|
||||
$(".primary-tabs").append(newdiv);
|
||||
$("#imgProgressRedirect").hide();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -306,16 +306,20 @@ ROC_AUTH.create_form = function() {
|
||||
};
|
||||
|
||||
|
||||
var password = document.getElementById("password")
|
||||
, confirm_password = document.getElementById("confirm_password");
|
||||
var password = document.getElementById("password");
|
||||
var confirm_password = document.getElementById("confirm_password");
|
||||
|
||||
ROC_AUTH.validatePassword =function(){
|
||||
if(password.value != confirm_password.value) {
|
||||
confirm_password.setCustomValidity("Passwords Don't Match");
|
||||
} else {
|
||||
confirm_password.setCustomValidity('');
|
||||
}
|
||||
if ((password != null) && (confirm_password != null)) {
|
||||
if(password.value != confirm_password.value) {
|
||||
confirm_password.setCustomValidity("Passwords Don't Match");
|
||||
} else {
|
||||
confirm_password.setCustomValidity('');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
password.onchange = ROC_AUTH.validatePassword();
|
||||
confirm_password.onkeyup = ROC_AUTH.validatePassword;
|
||||
if ((password != null) && (confirm_password != null)) {
|
||||
password.onchange = ROC_AUTH.validatePassword();
|
||||
confirm_password.onkeyup = ROC_AUTH.validatePassword;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<div class="primary-tabs">
|
||||
{unless isset="$user"}
|
||||
<h3>Login or <a href="{$site_url/}account/roc-register">Register</a></h3>
|
||||
<div>
|
||||
<div>
|
||||
<form name="cms_basic_auth" action method="POST">
|
||||
<div>
|
||||
<input type="text" name="username" id="username" required>
|
||||
<label>Username</label>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<input type="password" name="password" id="password" required>
|
||||
<label>Password</label>
|
||||
</div>
|
||||
|
||||
<button type="button" onclick="ROC_AUTH.login();">Login</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div>
|
||||
<p>
|
||||
<a href="{$site_url/}account/new-password">Forgot password?</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{/unless}
|
||||
</div>
|
||||
28
examples/demo/site/modules/feed_aggregator/config/feeds.json
Normal file
28
examples/demo/site/modules/feed_aggregator/config/feeds.json
Normal file
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"ids": ["news", "forum"],
|
||||
"feeds": {
|
||||
"news": {
|
||||
"title": "Eiffel related posts",
|
||||
"expiration": "21600",
|
||||
"size": 5,
|
||||
"locations": [
|
||||
"https://bertrandmeyer.com/feed/",
|
||||
"https://room.eiffel.com/blog/feed",
|
||||
"https://room.eiffel.com/article/feed",
|
||||
"https://room.eiffel.com/library/feed"
|
||||
]
|
||||
, "categories": ["Eiffel"]
|
||||
,"option_description": "enabled"
|
||||
},
|
||||
"forum": {
|
||||
"title": "Eiffel Forum",
|
||||
"expiration": "21600",
|
||||
"size": 5,
|
||||
"locations": [
|
||||
"https://groups.google.com/forum/feed/eiffel-users/msgs/atom.xml?num=15",
|
||||
"http://stackoverflow.com/feeds/tag?tagnames=eiffel&sort=newest"
|
||||
]
|
||||
,"option_description": "enabled"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
div.feed ul {
|
||||
list-style: none;
|
||||
position: relative;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
width: 99%;
|
||||
}
|
||||
div.feed li {
|
||||
/* border-top: solid 1px #ddd; */
|
||||
padding: 0;
|
||||
margin: 0 0 5px 0;
|
||||
}
|
||||
div.feed li a {
|
||||
font-weight: bold;
|
||||
}
|
||||
div.feed li .date {
|
||||
font-weight: bold;
|
||||
font-size: small;
|
||||
}
|
||||
div.feed li .category {
|
||||
margin-left: 20px;
|
||||
font-size: 8px;
|
||||
height: 9px;
|
||||
overflow: hidden;
|
||||
color: #999;
|
||||
}
|
||||
div.feed li .description {
|
||||
margin-left: 20px;
|
||||
font-size: small;
|
||||
height: 18px;
|
||||
overflow: hidden;
|
||||
color: #999;
|
||||
}
|
||||
div.feed li:hover {
|
||||
margin-bottom: 23px;
|
||||
}
|
||||
div.feed li:hover .description {
|
||||
padding: 5px;
|
||||
position: absolute;
|
||||
height: auto;
|
||||
overflow-y: scroll;
|
||||
overflow-x: scroll;
|
||||
color: #000;
|
||||
background-color: #fff;
|
||||
border: solid 1px #000;
|
||||
z-index: 10;
|
||||
}
|
||||
div.feed li:hover:last-child {
|
||||
margin-bottom: 28px;
|
||||
}
|
||||
div.feed li .description::after {
|
||||
content: "...";
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
div.feed {
|
||||
ul {
|
||||
list-style: none;
|
||||
position: relative;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
width: 99%;
|
||||
}
|
||||
li {
|
||||
/* border-top: solid 1px #ddd; */
|
||||
padding: 0;
|
||||
margin: 0 0 5px 0;
|
||||
|
||||
a {
|
||||
font-weight: bold;
|
||||
}
|
||||
.date {
|
||||
font-weight: bold;
|
||||
font-size: small;
|
||||
}
|
||||
.category {
|
||||
margin-left: 20px;
|
||||
font-size: 8px;
|
||||
height: 9px;
|
||||
overflow: hidden;
|
||||
color: #999;
|
||||
}
|
||||
.description {
|
||||
margin-left: 20px;
|
||||
font-size: small;
|
||||
height: 18px;
|
||||
overflow: hidden;
|
||||
color: #999;
|
||||
}
|
||||
&:hover {
|
||||
margin-bottom: 23px;
|
||||
.description {
|
||||
padding: 5px;
|
||||
position: absolute;
|
||||
height: auto;
|
||||
overflow-y: scroll;
|
||||
overflow-x: scroll;
|
||||
color: #000;
|
||||
background-color: #fff;
|
||||
border: solid 1px #000;
|
||||
z-index: 10;
|
||||
}
|
||||
&:last-child {
|
||||
margin-bottom: 28px;
|
||||
}
|
||||
}
|
||||
.description::after { content: "..."; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"gcse": {
|
||||
"cx":"",
|
||||
"secret_key":""
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<section>
|
||||
<header>
|
||||
<h2>Results for <kbd>{$result.current_page.search_terms/}</kbd></h2>
|
||||
</header>
|
||||
|
||||
<!-- list of results -->
|
||||
<ol start="{$result.current_page.start_index/}">
|
||||
|
||||
<!-- Item result -->
|
||||
{foreach from="$result.items" item="item"}
|
||||
<li>
|
||||
<article>
|
||||
<header>
|
||||
<h3>
|
||||
<cite>
|
||||
<a href="{$item.link/}">{$item.title/}</a>
|
||||
</cite>
|
||||
</h3>
|
||||
</header>
|
||||
<blockquote cite="{$item.link/}">
|
||||
<p>{$item.html_snippet/}</p>
|
||||
<footer>
|
||||
<p><abbr title="Uniform Resource Locator">Source</abbr> <a href="{$item.link/}">{$item.display_link/}</a></p>
|
||||
</footer>
|
||||
</blockquote>
|
||||
</article>
|
||||
</li>
|
||||
{/foreach}
|
||||
|
||||
|
||||
</ol>
|
||||
<ul class="cms-page-links">
|
||||
{if isset="$result.previous_page"}
|
||||
<li><a href="{$site_url/}gcse/?q={$result.previous_page.search_terms/}&start={$result.previous_page.start_index/}&num={$result.previous_page.count/}">Previous</a></li>
|
||||
{/if}
|
||||
{if isset="$result.next_page"}
|
||||
<li><a href="{$site_url/}gcse/?q={$result.next_page.search_terms/}&start={$result.next_page.start_index/}&num={$result.next_page.count/}">Next</a></li>
|
||||
{/if}
|
||||
</ul>
|
||||
</section>
|
||||
@@ -11,12 +11,27 @@ CREATE TABLE nodes (
|
||||
`publish` DATETIME,
|
||||
`created` DATETIME NOT NULL,
|
||||
`changed` DATETIME NOT NULL,
|
||||
`status` INTEGER
|
||||
`status` INTEGER,
|
||||
CONSTRAINT Unique_nid_revision UNIQUE (nid,revision)
|
||||
);
|
||||
|
||||
CREATE TABLE node_revisions (
|
||||
`nid` INTEGER NOT NULL,
|
||||
`revision` INTEGER NOT NULL,
|
||||
`title` VARCHAR(255) NOT NULL,
|
||||
`summary` TEXT,
|
||||
`content` TEXT,
|
||||
`format` VARCHAR(128),
|
||||
`author` INTEGER,
|
||||
`changed` DATETIME NOT NULL,
|
||||
`status` INTEGER,
|
||||
CONSTRAINT Unique_nid_revision PRIMARY KEY (nid,revision)
|
||||
);
|
||||
|
||||
CREATE TABLE page_nodes(
|
||||
`nid` INTEGER PRIMARY KEY AUTO_INCREMENT NOT NULL,
|
||||
`revision` INTEGER,
|
||||
`parent` INTEGER
|
||||
`nid` INTEGER NOT NULL,
|
||||
`revision` INTEGER NOT NULL,
|
||||
`parent` INTEGER,
|
||||
CONSTRAINT PK_nid_revision PRIMARY KEY (nid,revision)
|
||||
);
|
||||
|
||||
|
||||
@@ -4,7 +4,10 @@ CREATE TABLE $table_name (
|
||||
`access_token` TEXT NOT NULL,
|
||||
`created` DATETIME NOT NULL,
|
||||
`details` TEXT NOT NULL,
|
||||
`email` TEXT NOT NULL,
|
||||
CONSTRAINT `uid`
|
||||
UNIQUE(`uid`)
|
||||
UNIQUE(`uid`),
|
||||
CONSTRAINT `email`
|
||||
UNIQUE(`email`)
|
||||
);
|
||||
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
<hr>
|
||||
{unless isempty="$oauth_associated"}
|
||||
<h4>Un-Associate Account with Oauth Consumer</h4>
|
||||
<div>
|
||||
{foreach item="consumer" from="$oauth_associated"}
|
||||
<div>
|
||||
<form method="post" action="{$site_url/}account/oauth-un-associate">
|
||||
<input type="hidden" name="consumer" value="{$consumer/}"/>
|
||||
<div>
|
||||
<button type="submit">Unlink {$consumer/}</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
{/foreach}
|
||||
</div>
|
||||
{/unless}
|
||||
{unless isempty="$oauth_not_associated"}
|
||||
<h4>Associate Account with Oauth Consumer</h4>
|
||||
<div>
|
||||
{foreach item="consumer" from="$oauth_not_associated"}
|
||||
<div>
|
||||
<form method="post" action="{$site_url/}account/oauth-associate">
|
||||
<input type="hidden" name="consumer" value="{$consumer/}"/>
|
||||
<div>
|
||||
<input type="email" id="email" name="email" value="{$email/}" required/>
|
||||
<button type="submit">Link with {$consumer/}</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
{/foreach}
|
||||
</div>
|
||||
{/unless}
|
||||
@@ -0,0 +1,11 @@
|
||||
|
||||
CREATE TABLE openid_consumers(
|
||||
`cid` INTEGER PRIMARY KEY NOT NULL CHECK(`cid`>=0),
|
||||
`name` VARCHAR(255) NOT NULL,
|
||||
`endpoint` VARCHAR (255) NOT NULL,
|
||||
CONSTRAINT `cid`
|
||||
UNIQUE(`cid`),
|
||||
CONSTRAINT `name`
|
||||
UNIQUE(`name`)
|
||||
);
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
-- Change the values TO_COMPLETE based on your API.
|
||||
-- API SECTET KEY AND API PUBLIC KEY
|
||||
INSERT INTO openid_consumers (name, endpoint)
|
||||
VALUES ('yahoo', 'https://me.yahoo.com/');
|
||||
11
examples/demo/site/modules/openid/scripts/openid_items.sql
Normal file
11
examples/demo/site/modules/openid/scripts/openid_items.sql
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
CREATE TABLE openid_items (
|
||||
`uid` INTEGER PRIMARY KEY NOT NULL CHECK(`uid`>=0),
|
||||
`identity` TEXT NOT NULL,
|
||||
`created` DATETIME NOT NULL,
|
||||
CONSTRAINT `uid`
|
||||
UNIQUE(`uid`),
|
||||
CONSTRAINT `identity`
|
||||
UNIQUE(`identity`)
|
||||
);
|
||||
|
||||
18
examples/demo/site/modules/openid/templates/block_login.tpl
Normal file
18
examples/demo/site/modules/openid/templates/block_login.tpl
Normal file
@@ -0,0 +1,18 @@
|
||||
<div>
|
||||
<form action="{$site_url/}account/roc-openid-login" id="openid-login" method="POST">
|
||||
<div>
|
||||
<strong><label for="openid">OpenID identifier</label></strong><br/>
|
||||
<input type="text" name="openid" value="" size="50"/>
|
||||
</div>
|
||||
<div><input type="submit" name="op" value="Validate"/></div>
|
||||
<div hgv vtid="openid">Login with
|
||||
{foreach item="item" from="$openid_consumers"}
|
||||
<a href="{$site_url/}account/login-with-openid/{$item/}">{$item/}</a><br>
|
||||
{/foreach}
|
||||
</form>
|
||||
<div>
|
||||
{if isset="$error"}
|
||||
<span><i>{$error/}</i></span> <br>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
@@ -51,16 +51,24 @@ ul.horizontal li {
|
||||
.sidebar {
|
||||
padding: 5px;
|
||||
margin: 3px;
|
||||
border: solid 1px #ccc;
|
||||
/* border: solid 1px #ccc; */
|
||||
}
|
||||
.sidebar#sidebar_first {
|
||||
width: 250px;
|
||||
float: left;
|
||||
position: fixed;
|
||||
top: 45px;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
width: 200px;
|
||||
border-right: solid 1px #ddd;
|
||||
}
|
||||
.sidebar#sidebar_second {
|
||||
width: 250px;
|
||||
float: right;
|
||||
}
|
||||
.sidebar + .main {
|
||||
margin-left: 200px;
|
||||
}
|
||||
|
||||
#primary-tabs ul.horizontal {
|
||||
list-style-type: none;
|
||||
@@ -76,3 +84,9 @@ ul.horizontal li {
|
||||
border-width: 2px 1px 0;
|
||||
padding: 2px 7px 1px;
|
||||
}
|
||||
|
||||
#message li.error {
|
||||
background-color: #f99;
|
||||
border: solid 1px red;
|
||||
padding: 5px 2px 5px 2px;
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,8 @@
|
||||
$(document).ready(function() {
|
||||
$('#gcse_search_form').submit(function() {
|
||||
window.open('', 'formpopup', 'width=600,height=600,resizeable,scrollbars');
|
||||
this.target = 'formpopup';
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -55,15 +55,24 @@ ul.horizontal {
|
||||
.sidebar {
|
||||
padding: 5px;
|
||||
margin: 3px;
|
||||
border: solid 1px #ccc;
|
||||
/* border: solid 1px #ccc; */
|
||||
&#sidebar_first {
|
||||
width: 250px;
|
||||
float: left;
|
||||
position: fixed;
|
||||
top: 45px;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
width: 200px;
|
||||
border-right: solid 1px #ddd;
|
||||
}
|
||||
&#sidebar_second {
|
||||
width: 250px;
|
||||
float: right;
|
||||
}
|
||||
|
||||
&+.main {
|
||||
margin-left: 200px;
|
||||
}
|
||||
}
|
||||
#primary-tabs {
|
||||
ul.horizontal {
|
||||
@@ -81,3 +90,8 @@ ul.horizontal {
|
||||
}
|
||||
}
|
||||
}
|
||||
#message li.error {
|
||||
background-color: #f99;
|
||||
border: solid 1px red;
|
||||
padding: 5px 2px 5px 2px;
|
||||
}
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
<div class='navbar navbar-inverse'>
|
||||
<div class='navbar-inner nav-collapse' style="height: auto;">
|
||||
<ul class="nav">
|
||||
{$header_block/}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@@ -5,13 +5,15 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<!-- EWF CMS -->
|
||||
<link rel="stylesheet" href="{$site_url/}theme/css/style.css">
|
||||
<link rel="stylesheet" href="{$site_url/}theme/css/node.css">
|
||||
|
||||
<!-- CMS Blog Module -->
|
||||
<link rel="stylesheet" href="{$site_url/}theme/css/blog.css">
|
||||
|
||||
|
||||
<!-- jQuery dep -->
|
||||
<script src="{$site_url/}theme/js/jquery-1.10.2.min.js"></script>
|
||||
<script src="{$site_url/}theme/js/roc_auth.js"></script>
|
||||
<script src="{$site_url/}theme/js/popup_search.js"></script>
|
||||
|
||||
{if isset="$head"}{$head/}{/if}
|
||||
{if isset="$styles"}{$styles/}{/if}
|
||||
{if isset="$scripts"}{$scripts/}{/if}
|
||||
{if isset="$head_lines"}{$head_lines/}{/if}
|
||||
|
||||
<!-- bootstrap framework -->
|
||||
<!-- Latest compiled and minified CSS -->
|
||||
@@ -35,7 +37,17 @@
|
||||
{$page.primary_nav/}
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<!-- Page search -->
|
||||
<div class="row">
|
||||
<div class="col-md-2 col-md-offset-9">
|
||||
<form action="{$site_url/}gcse" class="search-form" id="gcse_search_form">
|
||||
<div class="form-group has-feedback">
|
||||
<input type="search" class="form-control" name="q" id="gcse_search" placeholder="search">
|
||||
<span class="glyphicon glyphicon-search form-control-feedback"></span>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<!-- General Page Content -->
|
||||
<div id='content' class='row-fluid'>
|
||||
<!-- Left Sidebar sidebar_first -->
|
||||
@@ -48,7 +60,7 @@
|
||||
{/unless}
|
||||
|
||||
<!-- Highlighted, Help, Content -->
|
||||
<div class='span8 main'>
|
||||
<div id='main' class='span8 main'>
|
||||
<!-- Highlighted Section -->
|
||||
{unless isempty="$page.region_highlighted"}
|
||||
<div id="highlighted">{$page.region_highlighted/}</div>
|
||||
@@ -61,9 +73,15 @@
|
||||
<!-- Main Content Section -->
|
||||
{unless isempty="$page_title"}<h1 class="page-title">{$page_title/}</h1>{/unless}
|
||||
{$page.region_content/}
|
||||
{if condition="$page.is_front"}
|
||||
{if isset="$page.region_feed_news"}
|
||||
<div class="column" style="width: 45%; float: left">{$page.region_feed_news/}</div>
|
||||
{/if}
|
||||
{if isset="$page.region_feed_forum"}
|
||||
<div class="column" style="width: 45%; float: left">{$page.region_feed_forum/}</div>
|
||||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ regions[content] = Content
|
||||
regions[highlighted] = Highlighted
|
||||
regions[help] = Help
|
||||
regions[footer] = Footer
|
||||
regions[first_sidebar] = first sidebar
|
||||
regions[second_sidebar] = second sidebar
|
||||
regions[sidebar_first] = first sidebar
|
||||
regions[sidebar_second] = second sidebar
|
||||
regions[page_bottom] = Bottom
|
||||
navigation=default_nav
|
||||
navigation=default_nav
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
<h2>Help Section</h2>
|
||||
@@ -1 +0,0 @@
|
||||
<h1>Highlighted Section</h1>
|
||||
@@ -1,8 +0,0 @@
|
||||
<div class='span2 sidebar'>
|
||||
<h3>Left Sidebar</h3>
|
||||
<ul class="nav nav-tabs nav-stacked">
|
||||
<li><a href='#'>Another Link 1</a></li>
|
||||
<li><a href='#'>Another Link 2</a></li>
|
||||
<li><a href='#'>Another Link 3</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -1,4 +0,0 @@
|
||||
<h2>Main Content Section</h2>
|
||||
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum.<p>
|
||||
|
||||
<p>Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare quam littera gothica, quam nunc putamus parum claram, anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes in futurum.</p>
|
||||
@@ -1,9 +0,0 @@
|
||||
<div id="footer">
|
||||
<small>
|
||||
<center>
|
||||
<p class="text-muted"><a href="#" target="_blank" class="info">ROC Documentation </a>
|
||||
<a href="http://www.eiffel.com/company/contact/" 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>
|
||||
</div>
|
||||
@@ -1,34 +0,0 @@
|
||||
<div class="navbar navbar-default" role="navigation">
|
||||
<div class="container-fluid">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
||||
<span class="sr-only">Toggle navigation</span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="{$site_url/}" itemprop="home" rel="home">{unless isset="$site_name"}Eiffel CMS{/unless}{if isset="$site_name"}{$site_name/}{/if}</a>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="navbar-collapse collapse">
|
||||
|
||||
{if isset="$primary_nav"}
|
||||
<ul class="nav navbar-nav navbar-left">
|
||||
{foreach item="item" from="$primary_nav.items"}
|
||||
<!-- TODO check if a menu item is active or not -->
|
||||
<li class="active"><a href="{$item.location/}">{$item.title/}</a></li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
{/if}
|
||||
|
||||
{if isset="$secondary_nav"}
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
{foreach item="item" from="$secondary_nav.items"}
|
||||
<!-- TODO check if a menu item is active or not -->
|
||||
<li class="active"><a href="{$item.location/}">{$item.title/}</a></li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
{if isset="$default_nav"}
|
||||
<div class="navbar navbar-default" role="navigation">
|
||||
<div class="container-fluid">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
||||
<span class="sr-only">Toggle navigation</span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="${site_url/}" itemprop="home" rel="home">{$page_title/}</a>
|
||||
</div>
|
||||
|
||||
<div class="navbar-collapse collapse">
|
||||
{/if}
|
||||
|
||||
{if isset="$primary_nav"}
|
||||
{$primary_nav/}
|
||||
{/if}
|
||||
|
||||
{if isset="$secondary_nav"}
|
||||
{$secondary_nav/}
|
||||
{/if}
|
||||
|
||||
{if isset="$default_nav"}
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
@@ -1,6 +0,0 @@
|
||||
<ul class="nav navbar-nav navbar-left">
|
||||
{foreach item="item" from="$menu.items"}
|
||||
<!-- TODO check if a menu item is active or not -->
|
||||
<li class="active"><a href="{$item.location/}">{$item.title/}</a></li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
@@ -1,8 +0,0 @@
|
||||
<div class='span2 sidebar'>
|
||||
<h3>Right Sidebar</h3>
|
||||
<ul class="nav nav-tabs nav-stacked">
|
||||
<li><a href='#'>Another Link 1</a></li>
|
||||
<li><a href='#'>Another Link 2</a></li>
|
||||
<li><a href='#'>Another Link 3</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -1,7 +0,0 @@
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
{foreach item="item" from="$menu.items"}
|
||||
<!-- TODO check if a menu item is active or not -->
|
||||
<li class="active"><a href="{$item.location/}">{$item.title/}</a></li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
|
||||
5849
examples/demo/site/www/static/css/bootstrap.css
vendored
5849
examples/demo/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,31 +1,21 @@
|
||||
note
|
||||
description: "Summary description for {EWF_ROC_SERVER_EXECUTION}."
|
||||
description: "[
|
||||
CMS Execution for the demo server.
|
||||
]"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
EWF_ROC_SERVER_EXECUTION
|
||||
DEMO_CMS_EXECUTION
|
||||
|
||||
inherit
|
||||
CMS_EXECUTION
|
||||
redefine
|
||||
initialize
|
||||
end
|
||||
|
||||
REFACTORING_HELPER
|
||||
|
||||
SHARED_LOGGER
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
initialize
|
||||
do
|
||||
Precursor
|
||||
end
|
||||
|
||||
initial_cms_setup: CMS_DEFAULT_SETUP
|
||||
-- CMS setup.
|
||||
local
|
||||
@@ -39,50 +29,61 @@ feature {NONE} -- Initialization
|
||||
create Result.make (l_env)
|
||||
end
|
||||
|
||||
feature -- CMS setup
|
||||
feature -- CMS storage
|
||||
|
||||
setup_storage (a_setup: CMS_SETUP)
|
||||
do
|
||||
debug ("refactor_fixme")
|
||||
to_implement ("To implement custom storage")
|
||||
end
|
||||
a_setup.storage_drivers.force (create {CMS_STORAGE_SQLITE3_BUILDER}.make, "sqlite3")
|
||||
-- a_setup.storage_drivers.force (create {CMS_STORAGE_STORE_MYSQL_BUILDER}.make, "mysql")
|
||||
a_setup.storage_drivers.force (create {CMS_STORAGE_STORE_ODBC_BUILDER}.make, "odbc")
|
||||
end
|
||||
|
||||
feature -- CMS modules
|
||||
|
||||
setup_modules (a_setup: CMS_SETUP)
|
||||
-- Setup additional modules.
|
||||
local
|
||||
m: CMS_MODULE
|
||||
do
|
||||
create {NODE_MODULE} m.make (a_setup)
|
||||
m.enable
|
||||
create {CMS_ADMIN_MODULE} m.make
|
||||
a_setup.register_module (m)
|
||||
|
||||
-- Auth
|
||||
create {CMS_AUTHENTICATION_MODULE} m.make
|
||||
m.enable
|
||||
a_setup.register_module (m)
|
||||
|
||||
create {BASIC_AUTH_MODULE} m.make
|
||||
if not a_setup.module_with_same_type_registered (m) then
|
||||
m.enable
|
||||
a_setup.register_module (m)
|
||||
end
|
||||
create {CMS_BASIC_AUTH_MODULE} m.make
|
||||
a_setup.register_module (m)
|
||||
|
||||
create {CMS_OAUTH_20_MODULE} m.make
|
||||
m.enable
|
||||
a_setup.register_module (m)
|
||||
|
||||
create {CMS_DEBUG_MODULE} m.make
|
||||
m.enable
|
||||
create {CMS_OPENID_MODULE} m.make
|
||||
a_setup.register_module (m)
|
||||
|
||||
create {CMS_DEMO_MODULE} m.make
|
||||
m.enable
|
||||
-- Nodes
|
||||
create {CMS_NODE_MODULE} m.make (a_setup)
|
||||
a_setup.register_module (m)
|
||||
|
||||
create {CMS_BLOG_MODULE} m.make
|
||||
m.enable
|
||||
a_setup.register_module (m)
|
||||
|
||||
-- Recent changes
|
||||
create {CMS_RECENT_CHANGES_MODULE} m.make
|
||||
a_setup.register_module (m)
|
||||
|
||||
-- Recent changes
|
||||
create {FEED_AGGREGATOR_MODULE} m.make
|
||||
a_setup.register_module (m)
|
||||
|
||||
-- Miscellanious
|
||||
create {CMS_DEBUG_MODULE} m.make
|
||||
a_setup.register_module (m)
|
||||
|
||||
create {CMS_DEMO_MODULE} m.make
|
||||
a_setup.register_module (m)
|
||||
|
||||
create {GOOGLE_CUSTOM_SEARCH_MODULE} m.make
|
||||
a_setup.register_module (m)
|
||||
end
|
||||
|
||||
18
examples/demo/src/demo_cms_server.e
Normal file
18
examples/demo/src/demo_cms_server.e
Normal file
@@ -0,0 +1,18 @@
|
||||
note
|
||||
description: "[
|
||||
DEMO application server.
|
||||
]"
|
||||
date: "$Date: 2015-02-09 22:29:56 +0100 (lun., 09 févr. 2015) $"
|
||||
revision: "$Revision: 96596 $"
|
||||
|
||||
class
|
||||
DEMO_CMS_SERVER
|
||||
|
||||
inherit
|
||||
ROC_CMS_LAUNCHER [DEMO_CMS_EXECUTION]
|
||||
|
||||
create
|
||||
make_and_launch
|
||||
|
||||
end
|
||||
|
||||
10
launcher/README.txt
Normal file
10
launcher/README.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
Collection of ROC CMS launcher ready to use.
|
||||
|
||||
- Include any-safe.ecf to use any of cgi, libfcgi or standalone connector.
|
||||
- Include standalone-safe.ecf to use standalone connector.
|
||||
- Include libfcgi-safe.ecf to use libfcgi connector.
|
||||
- Include cgi-safe.ecf to use cgi connector.
|
||||
|
||||
In application, the root class need to inherit from ROC_CMS_LAUNCHER with adapted CMS_EXECUTION
|
||||
descendant.
|
||||
|
||||
18
launcher/any-safe.ecf
Normal file
18
launcher/any-safe.ecf
Normal file
@@ -0,0 +1,18 @@
|
||||
<?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="launcher" uuid="6FDCA393-AFC3-436B-A58A-870923967C86" library_target="launcher">
|
||||
<target name="common" abstract="true">
|
||||
<root all_classes="true"/>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||
<library name="cms" location="..\cms-safe.ecf"/>
|
||||
<library name="cms_app_env" location="..\library\app_env\app_env-safe.ecf" readonly="false"/>
|
||||
<library name="wsf" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf-safe.ecf"/>
|
||||
</target>
|
||||
<target name="launcher" extends="common">
|
||||
<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"/>
|
||||
<library name="standalone" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\connector\standalone-safe.ecf"/>
|
||||
<cluster name="src" location=".\" recursive="false"/>
|
||||
<cluster name="launcher" location=".\any\" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
19
launcher/any.ecf
Normal file
19
launcher/any.ecf
Normal file
@@ -0,0 +1,19 @@
|
||||
<?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="launcher" uuid="6FDCA393-AFC3-436B-A58A-870923967C86" library_target="launcher">
|
||||
<target name="common" abstract="true">
|
||||
<root all_classes="true"/>
|
||||
<option void_safety="none" />
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
|
||||
<library name="cms" location="..\cms.ecf"/>
|
||||
<library name="cms_app_env" location="..\library\app_env\app_env.ecf" readonly="false"/>
|
||||
<library name="wsf" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf.ecf"/>
|
||||
</target>
|
||||
<target name="launcher" extends="common">
|
||||
<library name="cgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\connector\cgi.ecf"/>
|
||||
<library name="libfcgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\connector\libfcgi.ecf"/>
|
||||
<library name="nino" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\connector\nino.ecf"/>
|
||||
<library name="standalone" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\connector\standalone.ecf"/>
|
||||
<cluster name="src" location=".\" recursive="false"/>
|
||||
<cluster name="launcher" location=".\any\" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
19
launcher/any/application_launcher.e
Normal file
19
launcher/any/application_launcher.e
Normal file
@@ -0,0 +1,19 @@
|
||||
note
|
||||
description: "[
|
||||
Effective class for APPLICATION_LAUNCHER_I
|
||||
|
||||
You can put modification in this class
|
||||
]"
|
||||
date: "$Date: 2013-06-12 13:55:42 +0200 (mer., 12 juin 2013) $"
|
||||
revision: "$Revision: 36 $"
|
||||
|
||||
class
|
||||
APPLICATION_LAUNCHER [G -> WSF_EXECUTION create make end]
|
||||
|
||||
inherit
|
||||
APPLICATION_LAUNCHER_I [G]
|
||||
|
||||
feature -- Custom
|
||||
|
||||
end
|
||||
|
||||
127
launcher/any/application_launcher_i.e
Normal file
127
launcher/any/application_launcher_i.e
Normal file
@@ -0,0 +1,127 @@
|
||||
note
|
||||
description: "[
|
||||
Specific application launcher
|
||||
|
||||
DO NOT EDIT THIS CLASS
|
||||
|
||||
you can customize APPLICATION_LAUNCHER
|
||||
]"
|
||||
date: "$Date: 2013-06-12 13:55:42 +0200 (mer., 12 juin 2013) $"
|
||||
revision: "$Revision: 36 $"
|
||||
|
||||
deferred class
|
||||
APPLICATION_LAUNCHER_I [G -> WSF_EXECUTION create make end]
|
||||
|
||||
inherit
|
||||
SHARED_EXECUTION_ENVIRONMENT
|
||||
|
||||
feature -- Execution
|
||||
|
||||
launch (opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
|
||||
local
|
||||
nature: like launcher_nature
|
||||
do
|
||||
nature := launcher_nature
|
||||
if nature = Void then
|
||||
launch_standalone (opts)
|
||||
elseif nature = nature_standalone then
|
||||
launch_standalone (opts)
|
||||
elseif nature = nature_nino then
|
||||
launch_nino (opts)
|
||||
elseif nature = nature_cgi then
|
||||
launch_cgi (opts)
|
||||
elseif nature = nature_libfcgi then
|
||||
launch_libfcgi (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_standalone) then
|
||||
Result := nature_standalone
|
||||
end
|
||||
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
|
||||
Result := default_nature
|
||||
end
|
||||
|
||||
feature {NONE} -- standalone
|
||||
|
||||
nature_standalone: STRING = "standalone"
|
||||
|
||||
launch_standalone (opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
|
||||
local
|
||||
launcher: WSF_STANDALONE_SERVICE_LAUNCHER [G]
|
||||
do
|
||||
create launcher.make_and_launch (opts)
|
||||
end
|
||||
|
||||
feature {NONE} -- nino
|
||||
|
||||
nature_nino: STRING = "nino"
|
||||
|
||||
launch_nino (opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
|
||||
local
|
||||
launcher: WSF_NINO_SERVICE_LAUNCHER [G]
|
||||
do
|
||||
create launcher.make_and_launch (opts)
|
||||
end
|
||||
|
||||
feature {NONE} -- cgi
|
||||
|
||||
nature_cgi: STRING = "cgi"
|
||||
|
||||
launch_cgi (opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
|
||||
local
|
||||
launcher: WSF_CGI_SERVICE_LAUNCHER [G]
|
||||
do
|
||||
create launcher.make_and_launch (opts)
|
||||
end
|
||||
|
||||
feature {NONE} -- libfcgi
|
||||
|
||||
nature_libfcgi: STRING = "libfcgi"
|
||||
|
||||
launch_libfcgi (opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
|
||||
local
|
||||
launcher: WSF_LIBFCGI_SERVICE_LAUNCHER [G]
|
||||
do
|
||||
create launcher.make_and_launch (opts)
|
||||
end
|
||||
|
||||
feature -- Default
|
||||
|
||||
default_nature: STRING
|
||||
do
|
||||
Result := nature_standalone
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
15
launcher/cgi-safe.ecf
Normal file
15
launcher/cgi-safe.ecf
Normal file
@@ -0,0 +1,15 @@
|
||||
<?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="cgi_launcher" uuid="0FE4F1D0-BB70-4C7F-A66E-B27F1D718109" library_target="cgi_launcher">
|
||||
<target name="common" abstract="true">
|
||||
<root all_classes="true"/>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||
<library name="cms" location="..\cms-safe.ecf"/>
|
||||
<library name="cms_app_env" location="..\library\app_env\app_env-safe.ecf" readonly="false"/>
|
||||
<library name="wsf" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf-safe.ecf"/>
|
||||
</target>
|
||||
<target name="cgi_launcher" extends="common">
|
||||
<library name="default_cgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\default\cgi-safe.ecf"/>
|
||||
<cluster name="src" location=".\" recursive="false"/>
|
||||
<cluster name="launcher" location=".\default\" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
19
launcher/default/application_launcher.e
Normal file
19
launcher/default/application_launcher.e
Normal file
@@ -0,0 +1,19 @@
|
||||
note
|
||||
description: "[
|
||||
Effective class for APPLICATION_LAUNCHER_I
|
||||
|
||||
You can put modification in this class
|
||||
]"
|
||||
date: "$Date: 2013-06-12 13:55:42 +0200 (mer., 12 juin 2013) $"
|
||||
revision: "$Revision: 36 $"
|
||||
|
||||
class
|
||||
APPLICATION_LAUNCHER [G -> WSF_EXECUTION create make end]
|
||||
|
||||
inherit
|
||||
APPLICATION_LAUNCHER_I [G]
|
||||
|
||||
feature -- Custom
|
||||
|
||||
end
|
||||
|
||||
26
launcher/default/application_launcher_i.e
Normal file
26
launcher/default/application_launcher_i.e
Normal file
@@ -0,0 +1,26 @@
|
||||
note
|
||||
description: "[
|
||||
Specific application launcher
|
||||
|
||||
DO NOT EDIT THIS CLASS
|
||||
|
||||
you can customize APPLICATION_LAUNCHER
|
||||
]"
|
||||
date: "$Date: 2015-02-09 22:29:56 +0100 (lun., 09 févr. 2015) $"
|
||||
revision: "$Revision: 96596 $"
|
||||
|
||||
deferred class
|
||||
APPLICATION_LAUNCHER_I [G -> WSF_EXECUTION create make end]
|
||||
|
||||
feature -- Execution
|
||||
|
||||
launch (opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
|
||||
local
|
||||
launcher: WSF_DEFAULT_SERVICE_LAUNCHER [G]
|
||||
do
|
||||
create launcher.make_and_launch (opts)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
15
launcher/libfcgi-safe.ecf
Normal file
15
launcher/libfcgi-safe.ecf
Normal file
@@ -0,0 +1,15 @@
|
||||
<?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="libfcgi_launcher" uuid="04D7D1EA-059B-4024-B0DE-BBB57AB2D00C" library_target="libfcgi_launcher">
|
||||
<target name="common" abstract="true">
|
||||
<root all_classes="true"/>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||
<library name="cms" location="..\cms-safe.ecf"/>
|
||||
<library name="cms_app_env" location="..\library\app_env\app_env-safe.ecf" readonly="false"/>
|
||||
<library name="wsf" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf-safe.ecf"/>
|
||||
</target>
|
||||
<target name="libfcgi_launcher" extends="common">
|
||||
<library name="default_libfcgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\default\libfcgi-safe.ecf"/>
|
||||
<cluster name="src" location=".\" recursive="false"/>
|
||||
<cluster name="launcher" location=".\default\" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
16
launcher/libfcgi.ecf
Normal file
16
launcher/libfcgi.ecf
Normal file
@@ -0,0 +1,16 @@
|
||||
<?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="libfcgi_launcher" uuid="04D7D1EA-059B-4024-B0DE-BBB57AB2D00C" library_target="libfcgi_launcher">
|
||||
<target name="common" abstract="true">
|
||||
<root all_classes="true"/>
|
||||
<option void_safety="none" />
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
|
||||
<library name="cms" location="..\cms.ecf"/>
|
||||
<library name="cms_app_env" location="..\library\app_env\app_env.ecf" readonly="false"/>
|
||||
<library name="wsf" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf.ecf"/>
|
||||
</target>
|
||||
<target name="libfcgi_launcher" extends="common">
|
||||
<library name="default_libfcgi" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\default\libfcgi.ecf"/>
|
||||
<cluster name="src" location=".\" recursive="false"/>
|
||||
<cluster name="launcher" location=".\default\" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
@@ -1,12 +1,12 @@
|
||||
note
|
||||
description: "[
|
||||
application service
|
||||
Reusable ROC CMS launcher.
|
||||
]"
|
||||
date: "$Date: 2015-02-09 22:29:56 +0100 (lun., 09 févr. 2015) $"
|
||||
revision: "$Revision: 96596 $"
|
||||
|
||||
class
|
||||
EWF_ROC_SERVER
|
||||
ROC_CMS_LAUNCHER [G -> CMS_EXECUTION create make end]
|
||||
|
||||
inherit
|
||||
WSF_LAUNCHABLE_SERVICE
|
||||
@@ -37,16 +37,27 @@ feature {NONE} -- Initialization
|
||||
-- Initialize current service.
|
||||
local
|
||||
env: CMS_ENVIRONMENT
|
||||
l_app_name: detachable READABLE_STRING_32
|
||||
do
|
||||
Precursor
|
||||
create {WSF_SERVICE_LAUNCHER_OPTIONS_FROM_INI} service_options.make_from_file ("demo.ini")
|
||||
create env.make_default
|
||||
l_app_name := optional_application_name
|
||||
if l_app_name = Void then
|
||||
l_app_name := env.name
|
||||
end
|
||||
create {WSF_SERVICE_LAUNCHER_OPTIONS_FROM_INI} service_options.make_from_file (l_app_name + ".ini")
|
||||
initialize_logger (env)
|
||||
end
|
||||
|
||||
optional_application_name: detachable READABLE_STRING_32
|
||||
-- Optional application name.
|
||||
--| Redefine if needed.
|
||||
do
|
||||
end
|
||||
|
||||
feature {NONE} -- Launch operation
|
||||
|
||||
launcher: APPLICATION_LAUNCHER [EWF_ROC_SERVER_EXECUTION]
|
||||
launcher: APPLICATION_LAUNCHER [G]
|
||||
|
||||
launch (opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)
|
||||
local
|
||||
@@ -70,7 +81,7 @@ feature {NONE} -- Launch operation
|
||||
l_message.append ("%N%N")
|
||||
end
|
||||
else
|
||||
l_message.append ("The application crash without available information")
|
||||
l_message.append ("The application crashed without information.")
|
||||
l_message.append ("%N%N")
|
||||
end
|
||||
-- send email shutdown
|
||||
16
launcher/standalone-safe.ecf
Normal file
16
launcher/standalone-safe.ecf
Normal file
@@ -0,0 +1,16 @@
|
||||
<?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="standalone_launcher" uuid="F42660A9-26C2-466B-A63C-C7823C808BE7" library_target="standalone_launcher">
|
||||
<target name="common" abstract="true">
|
||||
<root all_classes="true"/>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||
<library name="cms" location="..\cms-safe.ecf"/>
|
||||
<library name="cms_app_env" location="..\library\app_env\app_env-safe.ecf" readonly="false"/>
|
||||
<library name="wsf" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf-safe.ecf"/>
|
||||
</target>
|
||||
<target name="standalone_launcher" extends="common">
|
||||
<library name="default_standalone" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\default\standalone-safe.ecf"/>
|
||||
<library name="standalone" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\connector\standalone-safe.ecf"/>
|
||||
<cluster name="src" location=".\" recursive="false"/>
|
||||
<cluster name="launcher" location=".\default\" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
17
launcher/standalone.ecf
Normal file
17
launcher/standalone.ecf
Normal file
@@ -0,0 +1,17 @@
|
||||
<?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="standalone_launcher" uuid="F42660A9-26C2-466B-A63C-C7823C808BE7" library_target="standalone_launcher">
|
||||
<target name="common" abstract="true">
|
||||
<root all_classes="true"/>
|
||||
<option void_safety="none" />
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
|
||||
<library name="cms" location="..\cms.ecf"/>
|
||||
<library name="cms_app_env" location="..\library\app_env\app_env.ecf" readonly="false"/>
|
||||
<library name="wsf" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf.ecf"/>
|
||||
</target>
|
||||
<target name="standalone_launcher" extends="common">
|
||||
<library name="default_standalone" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\default\standalone.ecf"/>
|
||||
<library name="standalone" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\connector\standalone.ecf"/>
|
||||
<cluster name="src" location=".\" recursive="false"/>
|
||||
<cluster name="launcher" location=".\default\" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
@@ -33,11 +33,53 @@ feature -- Query
|
||||
end
|
||||
end
|
||||
|
||||
resolved_text_list_item (k: READABLE_STRING_GENERAL): detachable LIST [READABLE_STRING_32]
|
||||
-- List of String item associated with key `k',
|
||||
-- and expanded values to resolved variables ${varname}.
|
||||
do
|
||||
if attached text_list_item (k) as lst then
|
||||
from
|
||||
lst.start
|
||||
until
|
||||
lst.after
|
||||
loop
|
||||
lst.replace (resolved_expression (lst.item))
|
||||
lst.forth
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
resolved_text_table_item (k: READABLE_STRING_GENERAL): detachable STRING_TABLE [READABLE_STRING_32]
|
||||
-- Table of String item associated with key `k',
|
||||
-- and expanded values to resolved variables ${varname}.
|
||||
do
|
||||
if attached text_table_item (k) as tb then
|
||||
from
|
||||
tb.start
|
||||
until
|
||||
tb.after
|
||||
loop
|
||||
tb.replace (resolved_expression (tb.item_for_iteration), tb.key_for_iteration)
|
||||
tb.forth
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
text_item (k: READABLE_STRING_GENERAL): detachable READABLE_STRING_32
|
||||
-- String item associated with key `k'.
|
||||
deferred
|
||||
end
|
||||
|
||||
text_list_item (k: READABLE_STRING_GENERAL): detachable LIST [READABLE_STRING_32]
|
||||
-- List of String item associated with key `k'.
|
||||
deferred
|
||||
end
|
||||
|
||||
text_table_item (k: READABLE_STRING_GENERAL): detachable STRING_TABLE [READABLE_STRING_32]
|
||||
-- Table of String item associated with key `k'.
|
||||
deferred
|
||||
end
|
||||
|
||||
integer_item (k: READABLE_STRING_GENERAL): INTEGER
|
||||
-- Integer item associated with key `k'.
|
||||
deferred
|
||||
@@ -109,7 +151,7 @@ feature -- Duplication
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2014, Jocelyn Fiat, Eiffel Software and others"
|
||||
copyright: "2011-2015, Jocelyn Fiat, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
|
||||
@@ -119,14 +119,47 @@ feature -- Access: Config Reader
|
||||
|
||||
text_item (k: READABLE_STRING_GENERAL): detachable READABLE_STRING_32
|
||||
-- String item associated with key `k'.
|
||||
local
|
||||
obj: like item
|
||||
do
|
||||
obj := item (k)
|
||||
if attached {READABLE_STRING_32} obj as s32 then
|
||||
Result := s32
|
||||
elseif attached {READABLE_STRING_8} obj as s then
|
||||
Result := utf.utf_8_string_8_to_escaped_string_32 (s)
|
||||
Result := value_to_string_32 (item (k))
|
||||
end
|
||||
|
||||
text_list_item (k: READABLE_STRING_GENERAL): detachable LIST [READABLE_STRING_32]
|
||||
-- List of String item associated with key `k'.
|
||||
do
|
||||
if attached {LIST [READABLE_STRING_8]} item (k) as l_list then
|
||||
create {ARRAYED_LIST [READABLE_STRING_32]} Result.make (l_list.count)
|
||||
Result.compare_objects
|
||||
across
|
||||
l_list as ic
|
||||
until
|
||||
Result = Void
|
||||
loop
|
||||
if attached value_to_string_32 (ic.item) as s32 then
|
||||
Result.force (s32)
|
||||
else
|
||||
Result := Void
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
text_table_item (k: READABLE_STRING_GENERAL): detachable STRING_TABLE [READABLE_STRING_32]
|
||||
-- Table of String item associated with key `k'.
|
||||
do
|
||||
if attached {STRING_TABLE [READABLE_STRING_8]} item (k) as l_list then
|
||||
create {STRING_TABLE [READABLE_STRING_32]} Result.make (l_list.count)
|
||||
Result.compare_objects
|
||||
across
|
||||
l_list as ic
|
||||
until
|
||||
Result = Void
|
||||
loop
|
||||
if attached value_to_string_32 (ic.item) as s32 then
|
||||
Result.force (s32, ic.key)
|
||||
else
|
||||
Result := Void
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -226,6 +259,15 @@ feature -- Access
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
value_to_string_32 (obj: detachable ANY): detachable STRING_32
|
||||
do
|
||||
if attached {READABLE_STRING_32} obj as s32 then
|
||||
Result := s32
|
||||
elseif attached {READABLE_STRING_8} obj as s then
|
||||
Result := utf.utf_8_string_8_to_escaped_string_32 (s)
|
||||
end
|
||||
end
|
||||
|
||||
item_from_values (a_values: STRING_TABLE [ANY]; k: READABLE_STRING_GENERAL): detachable ANY
|
||||
local
|
||||
i,j: INTEGER
|
||||
@@ -460,7 +502,7 @@ feature {NONE} -- Implementation
|
||||
invariant
|
||||
|
||||
note
|
||||
copyright: "2011-2014, Jocelyn Fiat, Eiffel Software and others"
|
||||
copyright: "2011-2015, Jocelyn Fiat, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
|
||||
@@ -63,10 +63,46 @@ feature -- Access: Config Reader
|
||||
text_item (k: READABLE_STRING_GENERAL): detachable READABLE_STRING_32
|
||||
-- String item associated with query `k'.
|
||||
do
|
||||
if attached {JSON_STRING} item (k) as l_string then
|
||||
Result := l_string.unescaped_string_32
|
||||
elseif attached {JSON_NUMBER} item (k) as l_number then
|
||||
Result := l_number.item
|
||||
Result := value_to_string_32 (item (k))
|
||||
end
|
||||
|
||||
text_list_item (k: READABLE_STRING_GENERAL): detachable LIST [READABLE_STRING_32]
|
||||
-- List of String item associated with key `k'.
|
||||
do
|
||||
if attached {JSON_ARRAY} item (k) as l_array then
|
||||
create {ARRAYED_LIST [READABLE_STRING_32]} Result.make (l_array.count)
|
||||
Result.compare_objects
|
||||
across
|
||||
l_array as ic
|
||||
until
|
||||
Result = Void
|
||||
loop
|
||||
if attached value_to_string_32 (ic.item) as s32 then
|
||||
Result.force (s32)
|
||||
else
|
||||
Result := Void
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
text_table_item (k: READABLE_STRING_GENERAL): detachable STRING_TABLE [READABLE_STRING_32]
|
||||
-- Table of String item associated with key `k'.
|
||||
do
|
||||
if attached {JSON_OBJECT} item (k) as obj then
|
||||
create {STRING_TABLE [READABLE_STRING_32]} Result.make (obj.count)
|
||||
Result.compare_objects
|
||||
across
|
||||
obj as ic
|
||||
until
|
||||
Result = Void
|
||||
loop
|
||||
if attached value_to_string_32 (ic.item) as s32 then
|
||||
Result.force (s32, ic.key.item)
|
||||
else
|
||||
Result := Void
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -105,6 +141,15 @@ feature -- Access
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
value_to_string_32 (v: detachable ANY): detachable STRING_32
|
||||
do
|
||||
if attached {JSON_STRING} v as l_string then
|
||||
Result := l_string.unescaped_string_32
|
||||
elseif attached {JSON_NUMBER} v as l_number then
|
||||
Result := l_number.item
|
||||
end
|
||||
end
|
||||
|
||||
object_json_value (a_object: JSON_OBJECT; a_query: READABLE_STRING_32): detachable JSON_VALUE
|
||||
-- Item associated with query `a_query' from object `a_object' if any.
|
||||
local
|
||||
@@ -163,7 +208,7 @@ feature {NONE} -- JSON
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2014, Jocelyn Fiat, Eiffel Software and others"
|
||||
copyright: "2011-2015, Jocelyn Fiat, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
source: "[
|
||||
Eiffel Software
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?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="config_tests" uuid="AD1DE0F7-BC8A-4A17-9A44-56C917BD5604">
|
||||
<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="config_tests" library_target="config_tests" uuid="AD1DE0F7-BC8A-4A17-9A44-56C917BD5604">
|
||||
<target name="config_tests">
|
||||
<root class="TEST_CONFIG_READER_SET" feature="default_create"/>
|
||||
<file_rule>
|
||||
|
||||
@@ -21,6 +21,18 @@ feature -- Test
|
||||
create {INI_CONFIG} cfg.make_from_string ("[
|
||||
foo = bar
|
||||
|
||||
collection[] = a
|
||||
collection[] = b
|
||||
collection[] = c
|
||||
collection[] = 1
|
||||
collection[] = 2
|
||||
collection[] = 3
|
||||
|
||||
table[a] = 1
|
||||
table[b] = 2
|
||||
table[c] = 3
|
||||
table[d] = test
|
||||
|
||||
[first]
|
||||
abc = 1
|
||||
def = and so on
|
||||
@@ -58,6 +70,21 @@ feature -- Test
|
||||
assert ("has_item (second.is)", cfg.has_item ("second.is"))
|
||||
assert ("item (second.is)", attached cfg.text_item ("second.is") as v and then v.same_string_general ("2"))
|
||||
|
||||
assert ("has_item (collection)", cfg.has_item ("collection"))
|
||||
assert ("item (collection)", attached cfg.text_list_item ("collection") as lst and then (
|
||||
lst.has ("a") and lst.has ("b") and lst.has ("c") and lst.has ("1") and lst.has ("2") and lst.has ("3")
|
||||
)
|
||||
)
|
||||
|
||||
assert ("has_item (table)", cfg.has_item ("table"))
|
||||
assert ("item (table)", attached cfg.text_table_item ("table") as tb and then (
|
||||
tb.item ("a") ~ {STRING_32} "1" and
|
||||
tb.item ("b") ~ {STRING_32} "2" and
|
||||
tb.item ("c") ~ {STRING_32} "3" and
|
||||
tb.item ("d") ~ {STRING_32} "test"
|
||||
)
|
||||
)
|
||||
|
||||
if attached cfg.sub_config ("second") as cfg_second then
|
||||
assert ("has_item (is)", cfg_second.has_item ("is"))
|
||||
assert ("item (is)", attached cfg_second.text_item ("is") as v and then v.same_string_general ("2"))
|
||||
@@ -141,7 +168,9 @@ feature -- Test
|
||||
"is": 2,
|
||||
"the": 3,
|
||||
"end": 4
|
||||
}
|
||||
},
|
||||
"collection": ["a", "b", "c", 1, 2, 3],
|
||||
"table": { "a": 1, "b": 2, "c": 3, "d" : "test" }
|
||||
}
|
||||
]")
|
||||
|
||||
@@ -164,6 +193,21 @@ feature -- Test
|
||||
assert ("item (second.the)", attached cfg.text_item ("second.the") as v and then v.same_string_general ("3"))
|
||||
assert ("item (second.end)", attached cfg.text_item ("second.end") as v and then v.same_string_general ("4"))
|
||||
|
||||
assert ("has_item (collection)", cfg.has_item ("collection"))
|
||||
assert ("item (collection)", attached cfg.text_list_item ("collection") as lst and then (
|
||||
lst.has ("a") and lst.has ("b") and lst.has ("c") and lst.has ("1") and lst.has ("2") and lst.has ("3")
|
||||
)
|
||||
)
|
||||
|
||||
assert ("has_item (table)", cfg.has_item ("table"))
|
||||
assert ("item (table)", attached cfg.text_table_item ("table") as tb and then (
|
||||
tb.item ("a") ~ {STRING_32} "1" and
|
||||
tb.item ("b") ~ {STRING_32} "2" and
|
||||
tb.item ("c") ~ {STRING_32} "3" and
|
||||
tb.item ("d") ~ {STRING_32} "test"
|
||||
)
|
||||
)
|
||||
|
||||
if attached cfg.sub_config ("second") as cfg_second then
|
||||
assert ("has_item (is)", cfg_second.has_item ("is"))
|
||||
assert ("item (is)", attached cfg_second.text_item ("is") as v and then v.same_string_general ("2"))
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
</option>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||
<library name="cms_app_env" location="..\app_env\app_env-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"/>
|
||||
<cluster name="src" location=".\" recursive="true"/>
|
||||
</target>
|
||||
|
||||
@@ -26,11 +26,8 @@ feature {NONE} -- Initialization
|
||||
|
||||
initialize
|
||||
-- Initialize service.
|
||||
local
|
||||
l_address_factory: INET_ADDRESS_FACTORY
|
||||
do
|
||||
admin_email := parameters.admin_email
|
||||
|
||||
create {NOTIFICATION_SMTP_MAILER} mailer.make (parameters.smtp_server)
|
||||
set_successful
|
||||
end
|
||||
|
||||
4
library/gcse/Readme.md
Normal file
4
library/gcse/Readme.md
Normal file
@@ -0,0 +1,4 @@
|
||||
Google Custom Search Engine Eiffel Lbrary
|
||||
|
||||
Based on https://developers.google.com/custom-search/json-api/v1/using_rest
|
||||
|
||||
21
library/gcse/gcse-safe.ecf
Normal file
21
library/gcse/gcse-safe.ecf
Normal file
@@ -0,0 +1,21 @@
|
||||
<?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="gcse" uuid="81645CEF-4651-45CF-A890-B126E4A6D78C" library_target="gcse">
|
||||
<target name="gcse">
|
||||
<root all_classes="true"/>
|
||||
<file_rule>
|
||||
<exclude>/.git$</exclude>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
<exclude>/CVS$</exclude>
|
||||
<exclude>/.svn$</exclude>
|
||||
</file_rule>
|
||||
<option warning="true" void_safety="all">
|
||||
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
|
||||
</option>
|
||||
<setting name="console_application" value="true"/>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||
<library name="http_client_extension" location="..\http_client_extension\http_client_extension-safe.ecf" readonly="false"/>
|
||||
<library name="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json-safe.ecf" readonly="false"/>
|
||||
<library name="wsf_encoder" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\text\encoder\encoder-safe.ecf"/>
|
||||
<cluster name="gcse" location=".\src\" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
21
library/gcse/gcse.ecf
Normal file
21
library/gcse/gcse.ecf
Normal file
@@ -0,0 +1,21 @@
|
||||
<?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="gcse" uuid="81645CEF-4651-45CF-A890-B126E4A6D78C" library_target="gcse">
|
||||
<target name="gcse">
|
||||
<root all_classes="true"/>
|
||||
<file_rule>
|
||||
<exclude>/.git$</exclude>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
<exclude>/CVS$</exclude>
|
||||
<exclude>/.svn$</exclude>
|
||||
</file_rule>
|
||||
<option warning="true" void_safety="none">
|
||||
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
|
||||
</option>
|
||||
<setting name="console_application" value="true"/>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
|
||||
<library name="http_client_extension" location="..\http_client_extension\http_client_extension.ecf" readonly="false"/>
|
||||
<library name="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json.ecf" readonly="false"/>
|
||||
<library name="wsf_encoder" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\text\encoder\encoder.ecf"/>
|
||||
<cluster name="gcse" location=".\src\" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
10
library/gcse/license.lic
Normal file
10
library/gcse/license.lic
Normal file
@@ -0,0 +1,10 @@
|
||||
${NOTE_KEYWORD}
|
||||
copyright: "2011-${YEAR} Javier Velilla, 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
|
||||
]"
|
||||
236
library/gcse/src/gcse_api.e
Normal file
236
library/gcse/src/gcse_api.e
Normal file
@@ -0,0 +1,236 @@
|
||||
note
|
||||
description: "[
|
||||
Simple API to call Google Custome Search Engine
|
||||
Example call:
|
||||
GET https://www.googleapis.com/customsearch/v1?key=INSERT_YOUR_API_KEY&cx=017576662512468239146:omuauf_lfve&q=lectures
|
||||
]"
|
||||
date: "$Date: 2015-10-09 08:11:07 -0300 (vi., 09 oct. 2015) $"
|
||||
revision: "$Revision: 97973 $"
|
||||
EIS: "name=Google Custom Search Engine", "src=https://developers.google.com/custom-search/json-api/v1/using_rest", "protocol=uri"
|
||||
|
||||
class
|
||||
GCSE_API
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_query_parameters: GCSE_QUERY_PARAMETERS)
|
||||
-- Create an object GCSE with query_parameters `a_query_parameters'
|
||||
do
|
||||
query_parameter := a_query_parameters
|
||||
ensure
|
||||
query_parameters_set: query_parameter = a_query_parameters
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
base_uri: STRING_8 = "https://www.googleapis.com/customsearch/v1"
|
||||
-- Google custom search base URI.
|
||||
|
||||
query_parameter: GCSE_QUERY_PARAMETERS
|
||||
-- Google custom search parameters.
|
||||
|
||||
last_result: detachable GCSE_RESPONSE
|
||||
-- Search results.
|
||||
|
||||
feature -- Status Reports
|
||||
|
||||
errors: detachable LIST [READABLE_STRING_8]
|
||||
-- optional list of error messages.
|
||||
|
||||
feature -- API
|
||||
|
||||
search
|
||||
-- Search
|
||||
local
|
||||
l_parser: JSON_PARSER
|
||||
l_gcse_response: detachable GCSE_RESPONSE
|
||||
do
|
||||
-- Data format for the response.
|
||||
-- At the moment we are using the default value: json
|
||||
-- but it's possible to define atom response using the alt parameter.
|
||||
last_result := Void
|
||||
if attached get as l_response then
|
||||
create l_gcse_response
|
||||
l_gcse_response.set_status (l_response.status)
|
||||
l_gcse_response.set_status_nessage (l_response.status_message)
|
||||
|
||||
if attached l_response.body as l_body then
|
||||
create l_parser.make_with_string (l_body)
|
||||
l_parser.parse_content
|
||||
if l_response.status = 200 and then l_parser.is_parsed and then attached {JSON_OBJECT} l_parser.parsed_json_object as jv then
|
||||
-- Queries
|
||||
if attached {JSON_OBJECT} jv.item (queries_key) as jqueries then
|
||||
-- Next Page
|
||||
if attached {GCSE_PAGE} query_page (next_page_key, jqueries) as l_page then
|
||||
l_gcse_response.set_next_page (l_page)
|
||||
end
|
||||
-- Current Page
|
||||
if attached {GCSE_PAGE} query_page (request_key, jqueries) as l_page then
|
||||
l_gcse_response.set_current_page (l_page)
|
||||
end
|
||||
-- Previous Page
|
||||
if attached {GCSE_PAGE} query_page (previous_page_key, jqueries) as l_page then
|
||||
l_gcse_response.set_previous_page (l_page)
|
||||
end
|
||||
end
|
||||
if attached {JSON_ARRAY} jv.item (items_key) as jitems then
|
||||
across jitems as ic loop
|
||||
if attached{JSON_OBJECT} ic.item as j_item then
|
||||
l_gcse_response.add_item (item (j_item))
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
put_error (l_body)
|
||||
end
|
||||
else
|
||||
put_error (l_response.status.out)
|
||||
end
|
||||
else
|
||||
put_error ("unknown")
|
||||
end
|
||||
last_result := l_gcse_response
|
||||
end
|
||||
|
||||
feature {NONE} -- REST API
|
||||
|
||||
get: detachable RESPONSE
|
||||
-- Reading Data.
|
||||
local
|
||||
l_request: REQUEST
|
||||
do
|
||||
create l_request.make ("GET", new_uri)
|
||||
Result := l_request.execute
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
new_uri: STRING_8
|
||||
-- new uri (BaseUri?key=secret_value&cx=a_cx_id&q=a_query
|
||||
-- ?key=INSERT_YOUR_API_KEY&cx=017576662512468239146:omuauf_lfve&q=lectures
|
||||
-- full template BaseUri?q={searchTerms}&num={count?}&start={startIndex?}&lr={language?}&
|
||||
-- safe={safe?}&cx={cx?}&cref={cref?}&sort={sort?}&filter={filter?}&gl={gl?}&cr={cr?}&
|
||||
-- googlehost={googleHost?}&c2coff={disableCnTwTranslation?}&hq={hq?}&hl={hl?}&siteSearch={siteSearch?}&
|
||||
-- siteSearchFilter={siteSearchFilter?}&exactTerms={exactTerms?}&excludeTerms={excludeTerms?}&linkSite={linkSite?}&
|
||||
-- orTerms={orTerms?}&relatedSite={relatedSite?}&dateRestrict={dateRestrict?}&lowRange={lowRange?}&highRange={highRange?}&
|
||||
-- searchType={searchType}&fileType={fileType?}&rights={rights?}&imgSize={imgSize?}&imgType={imgType?}&
|
||||
-- imgColorType={imgColorType?}&imgDominantColor={imgDominantColor?}&alt=json"
|
||||
|
||||
do
|
||||
create Result.make_from_string (base_uri)
|
||||
Result.append ("?key=")
|
||||
Result.append (query_parameter.secret)
|
||||
Result.append ("&cx=")
|
||||
Result.append (query_parameter.cx)
|
||||
Result.append ("&q=")
|
||||
Result.append (query_parameter.query)
|
||||
-- num
|
||||
if attached query_parameter.num as l_num then
|
||||
Result.append ("&num=")
|
||||
Result.append (l_num)
|
||||
end
|
||||
if attached query_parameter.start as l_start then
|
||||
Result.append ("&start=")
|
||||
Result.append (l_start)
|
||||
end
|
||||
end
|
||||
|
||||
put_error (a_message: READABLE_STRING_GENERAL)
|
||||
-- put error message `a_message'.
|
||||
local
|
||||
l_errors: like errors
|
||||
utf: UTF_CONVERTER
|
||||
do
|
||||
l_errors := errors
|
||||
if l_errors = Void then
|
||||
create {ARRAYED_LIST [STRING]} l_errors.make (1)
|
||||
errors := l_errors
|
||||
end
|
||||
l_errors.force (utf.utf_32_string_to_utf_8_string_8 (a_message))
|
||||
end
|
||||
|
||||
item (a_item: JSON_OBJECT): GCSE_PAGE_ITEM
|
||||
-- Google Result Metadata Item.
|
||||
do
|
||||
create Result
|
||||
if attached {JSON_STRING} a_item.item ("kind") as l_kind then
|
||||
Result.set_kind (l_kind.item)
|
||||
end
|
||||
if attached {JSON_STRING} a_item.item ("title") as l_title then
|
||||
Result.set_title (l_title.item)
|
||||
end
|
||||
if attached {JSON_STRING} a_item.item ("htmlTitle") as l_htmltitle then
|
||||
Result.set_html_title (l_htmltitle.unescaped_string_32)
|
||||
end
|
||||
if attached {JSON_STRING} a_item.item ("link") as l_link then
|
||||
Result.set_link (l_link.item)
|
||||
end
|
||||
if attached {JSON_STRING} a_item.item ("displayLink") as l_display_link then
|
||||
Result.set_display_link (l_display_link.item)
|
||||
end
|
||||
if attached {JSON_STRING} a_item.item ("snippet") as l_snippet then
|
||||
Result.set_snippet (l_snippet.unescaped_string_8)
|
||||
end
|
||||
if attached {JSON_STRING} a_item.item ("htmlSnippet") as l_html_snippet then
|
||||
Result.set_html_snippet (l_html_snippet.unescaped_string_32)
|
||||
end
|
||||
if attached {JSON_STRING} a_item.item ("formattedUrl") as l_formatted_url then
|
||||
Result.set_formatted_url (l_formatted_url.item)
|
||||
end
|
||||
end
|
||||
|
||||
query_page (a_page_key: JSON_STRING; a_queries: JSON_OBJECT): detachable GCSE_PAGE
|
||||
-- Google result medata query. Return a query page based for a query with page key `a_page_key', if any.
|
||||
do
|
||||
if
|
||||
attached {JSON_ARRAY} a_queries.item (a_page_key) as jquerypage and then
|
||||
jquerypage.count > 0 and then
|
||||
attached {JSON_OBJECT} jquerypage.i_th (1) as jpage
|
||||
then
|
||||
create Result
|
||||
if attached {JSON_STRING} jpage.item ("title") as l_title then
|
||||
Result.set_title (l_title.item)
|
||||
end
|
||||
if attached {JSON_STRING} jpage.item ("totalResults") as l_results then
|
||||
Result.set_total_results (l_results.item.to_integer)
|
||||
end
|
||||
if attached {JSON_STRING} jpage.item ("searchTerms") as l_search_terms then
|
||||
Result.set_search_terms (l_search_terms.item)
|
||||
end
|
||||
-- TODO check if we should use INTEGER_64
|
||||
if attached {JSON_NUMBER} jpage.item ("count") as l_count then
|
||||
Result.set_count (l_count.integer_64_item.as_integer_32)
|
||||
end
|
||||
if attached {JSON_NUMBER} jpage.item ("startIndex") as l_index then
|
||||
Result.set_start_index (l_index.integer_64_item.as_integer_32)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
feature {NONE} -- JSON Keys
|
||||
|
||||
queries_key: STRING = "queries"
|
||||
|
||||
next_page_key: STRING = "nextPage"
|
||||
|
||||
request_key: STRING = "request"
|
||||
|
||||
previous_page_key: STRING = "previousPage"
|
||||
|
||||
items_key: STRING = "items"
|
||||
|
||||
note
|
||||
copyright: "2011-2015 Javier Velilla, 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
|
||||
118
library/gcse/src/gcse_page.e
Normal file
118
library/gcse/src/gcse_page.e
Normal file
@@ -0,0 +1,118 @@
|
||||
note
|
||||
description: "Represent metadata describing the query for the current set of results."
|
||||
date: "$Date: 2015-10-09 08:11:07 -0300 (vi., 09 oct. 2015) $"
|
||||
revision: "$Revision: 97973 $"
|
||||
|
||||
class
|
||||
GCSE_PAGE
|
||||
|
||||
inherit
|
||||
|
||||
DEBUG_OUTPUT
|
||||
|
||||
feature -- Access
|
||||
|
||||
search_terms: detachable STRING_8
|
||||
-- search term
|
||||
|
||||
title: detachable STRING_8
|
||||
-- Search title.
|
||||
|
||||
total_results: INTEGER
|
||||
-- Search total results.
|
||||
|
||||
count: INTEGER
|
||||
-- Rows per page.
|
||||
|
||||
start_index: INTEGER
|
||||
-- Page index.
|
||||
|
||||
feature -- Element change
|
||||
|
||||
set_search_terms (a_search_terms: like search_terms)
|
||||
-- Assign `search_terms' with `a_search_terms'.
|
||||
do
|
||||
search_terms := a_search_terms
|
||||
ensure
|
||||
search_terms_assigned: search_terms = a_search_terms
|
||||
end
|
||||
|
||||
feature -- Change element
|
||||
|
||||
set_title (a_title: like title)
|
||||
-- Set title with `a_title'
|
||||
do
|
||||
title := a_title
|
||||
ensure
|
||||
title_set: title = a_title
|
||||
end
|
||||
|
||||
set_total_results (a_total_results: like total_results)
|
||||
-- Set total_results with `a_total_results'.
|
||||
do
|
||||
total_results := a_total_results
|
||||
ensure
|
||||
total_results_set: total_results = a_total_results
|
||||
end
|
||||
|
||||
set_count (a_count: like count)
|
||||
-- Set count with `a_count'.
|
||||
do
|
||||
count := a_count
|
||||
ensure
|
||||
count_set: count = a_count
|
||||
end
|
||||
|
||||
set_start_index (a_start_index: like start_index)
|
||||
-- Set start_index with `a_start_index'.
|
||||
do
|
||||
start_index := a_start_index
|
||||
ensure
|
||||
start_index_set: start_index = a_start_index
|
||||
end
|
||||
|
||||
feature -- Status report
|
||||
|
||||
debug_output: STRING_8
|
||||
-- <Precursor>
|
||||
do
|
||||
create Result.make_from_string ("%NPage details%N")
|
||||
if attached title as l_title then
|
||||
Result.append ("Title:")
|
||||
Result.append (l_title)
|
||||
Result.append_character ('%N')
|
||||
end
|
||||
if attached search_terms as l_search_tearm then
|
||||
Result.append ("Search Tearm:")
|
||||
Result.append (l_search_tearm)
|
||||
Result.append_character ('%N')
|
||||
end
|
||||
|
||||
Result.append ("Count:")
|
||||
Result.append (count.out)
|
||||
Result.append_character ('%N')
|
||||
Result.append ("Total Result:")
|
||||
Result.append (count.out)
|
||||
Result.append_character ('%N')
|
||||
Result.append ("Count:")
|
||||
Result.append (total_results.out)
|
||||
Result.append_character ('%N')
|
||||
Result.append ("Start index:")
|
||||
Result.append (start_index.out)
|
||||
Result.append_character ('%N')
|
||||
|
||||
end
|
||||
|
||||
|
||||
note
|
||||
copyright: "2011-2015 Javier Velilla, 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
|
||||
209
library/gcse/src/gcse_page_item.e
Normal file
209
library/gcse/src/gcse_page_item.e
Normal file
@@ -0,0 +1,209 @@
|
||||
note
|
||||
description: "Represent a search result, include the URL, title and text snippets that describe the result"
|
||||
date: "$Date: 2015-10-09 08:11:07 -0300 (vi., 09 oct. 2015) $"
|
||||
revision: "$Revision: 97973 $"
|
||||
|
||||
class
|
||||
GCSE_PAGE_ITEM
|
||||
|
||||
inherit
|
||||
|
||||
DEBUG_OUTPUT
|
||||
|
||||
feature -- Access
|
||||
|
||||
html_formatted_url: detachable STRING_8
|
||||
-- Html formatted url of this result
|
||||
|
||||
formatted_url: detachable STRING_8
|
||||
-- Formatted url of this result
|
||||
|
||||
cache_id: detachable STRING_8
|
||||
-- Cache id of this result
|
||||
|
||||
html_snippet: detachable STRING_8
|
||||
-- Html snippet of this request
|
||||
|
||||
snippet: detachable STRING_8
|
||||
-- Snippet of this result
|
||||
|
||||
display_link: detachable STRING_8
|
||||
-- Display link of this result
|
||||
|
||||
link: detachable STRING_8
|
||||
-- link of this result
|
||||
|
||||
html_title: detachable STRING_8
|
||||
-- html title of result
|
||||
|
||||
title: detachable STRING_8
|
||||
-- title of result.
|
||||
|
||||
kind: detachable STRING_8
|
||||
-- Kind of actual search result.
|
||||
|
||||
page_map: detachable GCSE_PAGE_MAP
|
||||
-- Page map
|
||||
--! Not supported for now.
|
||||
|
||||
feature -- Element change
|
||||
|
||||
set_html_formatted_url (a_html_formatted_url: like html_formatted_url)
|
||||
-- Assign `html_formatted_url' with `a_html_formatted_url'.
|
||||
do
|
||||
html_formatted_url := a_html_formatted_url
|
||||
ensure
|
||||
html_formatted_url_assigned: html_formatted_url = a_html_formatted_url
|
||||
end
|
||||
|
||||
set_formatted_url (a_formatted_url: like formatted_url)
|
||||
-- Assign `formatted_url' with `a_formatted_url'.
|
||||
do
|
||||
formatted_url := a_formatted_url
|
||||
ensure
|
||||
formatted_url_assigned: formatted_url = a_formatted_url
|
||||
end
|
||||
|
||||
set_cache_id (a_cache_id: like cache_id)
|
||||
-- Assign `cache_id' with `a_cache_id'.
|
||||
do
|
||||
cache_id := a_cache_id
|
||||
ensure
|
||||
cache_id_assigned: cache_id = a_cache_id
|
||||
end
|
||||
|
||||
set_html_snippet (a_html_snippet: like html_snippet)
|
||||
-- Assign `html_snippet' with `a_html_snippet'.
|
||||
do
|
||||
html_snippet := a_html_snippet
|
||||
ensure
|
||||
html_snippet_assigned: html_snippet = a_html_snippet
|
||||
end
|
||||
|
||||
set_snippet (a_snippet: like snippet)
|
||||
-- Assign `snippet' with `a_snippet'.
|
||||
do
|
||||
snippet := a_snippet
|
||||
ensure
|
||||
snippet_assigned: snippet = a_snippet
|
||||
end
|
||||
|
||||
set_display_link (a_display_link: like display_link)
|
||||
-- Assign `display_link' with `a_display_link'.
|
||||
do
|
||||
display_link := a_display_link
|
||||
ensure
|
||||
display_link_assigned: display_link = a_display_link
|
||||
end
|
||||
|
||||
set_link (a_link: like link)
|
||||
-- Assign `link' with `a_link'.
|
||||
do
|
||||
link := a_link
|
||||
ensure
|
||||
link_assigned: link = a_link
|
||||
end
|
||||
|
||||
set_html_title (a_html_title: like html_title)
|
||||
-- Assign `html_title' with `a_html_title'.
|
||||
do
|
||||
html_title := a_html_title
|
||||
ensure
|
||||
html_title_assigned: html_title = a_html_title
|
||||
end
|
||||
|
||||
set_title (a_title: like title)
|
||||
-- Assign `title' with `a_title'.
|
||||
do
|
||||
title := a_title
|
||||
ensure
|
||||
title_assigned: title = a_title
|
||||
end
|
||||
|
||||
set_kind (a_kind: like kind)
|
||||
-- Assign `kind' with `a_kind'.
|
||||
do
|
||||
kind := a_kind
|
||||
ensure
|
||||
kind_assigned: kind = a_kind
|
||||
end
|
||||
|
||||
set_page_map (a_map: like page_map)
|
||||
-- Assign `kind' with `a_kind'.
|
||||
do
|
||||
page_map := a_map
|
||||
ensure
|
||||
page_map_assigned: page_map = a_map
|
||||
end
|
||||
|
||||
|
||||
feature -- Output
|
||||
|
||||
debug_output: STRING_8
|
||||
-- <Precursor>
|
||||
do
|
||||
create Result.make_from_string ("%NPage Item details%N")
|
||||
if attached title as l_title then
|
||||
Result.append ("Title:")
|
||||
Result.append (l_title)
|
||||
Result.append_character ('%N')
|
||||
end
|
||||
if attached kind as l_kind then
|
||||
Result.append ("Kind:")
|
||||
Result.append (l_kind)
|
||||
Result.append_character ('%N')
|
||||
end
|
||||
if attached html_title as l_html_title then
|
||||
Result.append ("Html title:")
|
||||
Result.append (l_html_title)
|
||||
Result.append_character ('%N')
|
||||
end
|
||||
if attached link as l_link then
|
||||
Result.append ("Link:")
|
||||
Result.append (l_link)
|
||||
Result.append_character ('%N')
|
||||
end
|
||||
if attached display_link as l_display_link then
|
||||
Result.append ("Display link:")
|
||||
Result.append (l_display_link)
|
||||
Result.append_character ('%N')
|
||||
end
|
||||
if attached snippet as l_snippet then
|
||||
Result.append ("Snippet:")
|
||||
Result.append (l_snippet)
|
||||
Result.append_character ('%N')
|
||||
end
|
||||
if attached html_snippet as l_html_snippet then
|
||||
Result.append ("Html snippet:")
|
||||
Result.append (l_html_snippet)
|
||||
Result.append_character ('%N')
|
||||
end
|
||||
if attached cache_id as l_cache_id then
|
||||
Result.append ("Cache_id:")
|
||||
Result.append (l_cache_id)
|
||||
Result.append_character ('%N')
|
||||
end
|
||||
if attached formatted_url as l_formatted_url then
|
||||
Result.append ("Formatted url:")
|
||||
Result.append (l_formatted_url)
|
||||
Result.append_character ('%N')
|
||||
end
|
||||
if attached html_formatted_url as l_html_formatted_url then
|
||||
Result.append ("Html formatted url:")
|
||||
Result.append (l_html_formatted_url)
|
||||
Result.append_character ('%N')
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2015 Javier Velilla, 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
|
||||
41
library/gcse/src/gcse_page_map.e
Normal file
41
library/gcse/src/gcse_page_map.e
Normal file
@@ -0,0 +1,41 @@
|
||||
note
|
||||
description: "[
|
||||
Represent a google page map
|
||||
"pagemap": {
|
||||
"cse_image": [
|
||||
{
|
||||
"src": "https://www.eiffel.org/portal/files/userpictures/picture-40.jpg"
|
||||
}
|
||||
],
|
||||
"cse_thumbnail": [
|
||||
{
|
||||
"width": "81",
|
||||
"height": "61",
|
||||
"src": "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcRnC-RKzps6BFItx_MLYBVskFI7U6u0y3VJBInomPYEF5sO6gkip94mLw"
|
||||
}
|
||||
]
|
||||
}
|
||||
]"
|
||||
date: "$Date: 2015-10-09 08:11:07 -0300 (vi., 09 oct. 2015) $"
|
||||
revision: "$Revision: 97973 $"
|
||||
EIS: "name=PageMaps", "src=https://developers.google.com/custom-search/docs/structured_data#pagemaps", "protocol=url"
|
||||
|
||||
class
|
||||
GCSE_PAGE_MAP
|
||||
|
||||
feature -- Access
|
||||
|
||||
|
||||
|
||||
|
||||
note
|
||||
copyright: "2011-2015 Javier Velilla, 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
|
||||
238
library/gcse/src/gcse_query_parameters.e
Normal file
238
library/gcse/src/gcse_query_parameters.e
Normal file
@@ -0,0 +1,238 @@
|
||||
note
|
||||
description: "[
|
||||
Represent google custom search parameters
|
||||
Example url template
|
||||
"template": "https://www.googleapis.com/customsearch/v1?q={searchTerms}&num={count?}&start={startIndex?}&lr={language?}&safe={safe?}&cx={cx?}&cref={cref?}&sort={sort?}&filter={filter?}&gl={gl?}&cr={cr?}&googlehost={googleHost?}&c2coff={disableCnTwTranslation?}&hq={hq?}&hl={hl?}&siteSearch={siteSearch?}&siteSearchFilter={siteSearchFilter?}&exactTerms={exactTerms?}&excludeTerms={excludeTerms?}&linkSite={linkSite?}&orTerms={orTerms?}&relatedSite={relatedSite?}&dateRestrict={dateRestrict?}&lowRange={lowRange?}&highRange={highRange?}&searchType={searchType}&fileType={fileType?}&rights={rights?}&imgSize={imgSize?}&imgType={imgType?}&imgColorType={imgColorType?}&imgDominantColor={imgDominantColor?}&alt=json"
|
||||
]"
|
||||
optional_parameters: "[
|
||||
Optional parameters
|
||||
c2coff string Enables or disables Simplified and Traditional Chinese Search.
|
||||
The default value for this parameter is 0 (zero), meaning that the feature is enabled. Supported values are:
|
||||
1: Disabled
|
||||
0: Enabled (default)
|
||||
cr string Restricts search results to documents originating in a particular country.
|
||||
You may use Boolean operators in the cr parameter's value.
|
||||
Google Search determines the country of a document by analyzing:
|
||||
the top-level domain (TLD) of the document's URL
|
||||
the geographic location of the Web server's IP address
|
||||
See the Country Parameter Values page for a list of valid values for this parameter.
|
||||
cref string The URL of a linked custom search engine specification to use for this request.
|
||||
Does not apply for Google Site Search
|
||||
If both cx and cref are specified, the cx value is used
|
||||
cx string The custom search engine ID to use for this request.
|
||||
If both cx and cref are specified, the cx value is used.
|
||||
dateRestrict string Restricts results to URLs based on date. Supported values include:
|
||||
d[number]: requests results from the specified number of past days.
|
||||
w[number]: requests results from the specified number of past weeks.
|
||||
m[number]: requests results from the specified number of past months.
|
||||
y[number]: requests results from the specified number of past years.
|
||||
exactTerms string Identifies a phrase that all documents in the search results must contain.
|
||||
excludeTerms string Identifies a word or phrase that should not appear in any documents in the search results.
|
||||
fileType string Restricts results to files of a specified extension. A list of file types indexable by Google can be found in Webmaster Tools Help Center.
|
||||
filter string Controls turning on or off the duplicate content filter.
|
||||
See Automatic Filtering for more information about Google's search results filters. Note that host crowding filtering applies only to multi-site searches.
|
||||
By default, Google applies filtering to all search results to improve the quality of those results.
|
||||
|
||||
|
||||
Acceptable values are:
|
||||
"0": Turns off duplicate content filter.
|
||||
"1": Turns on duplicate content filter.
|
||||
gl string Geolocation of end user.
|
||||
The gl parameter value is a two-letter country code. The gl parameter boosts search results whose country of origin matches the parameter value. See the Country Codes page for a list of valid values.
|
||||
Specifying a gl parameter value should lead to more relevant results. This is particularly true for international customers and, even more specifically, for customers in English- speaking countries other than the United States.
|
||||
googlehost string The local Google domain (for example, google.com, google.de, or google.fr) to use to perform the search.
|
||||
highRange string
|
||||
Specifies the ending value for a search range.
|
||||
Use lowRange and highRange to append an inclusive search range of lowRange...highRange to the query.
|
||||
hl string Sets the user interface language.
|
||||
Explicitly setting this parameter improves the performance and the quality of your search results.
|
||||
See the Interface Languages section of Internationalizing Queries and Results Presentation for more information, and Supported Interface Languages for a list of supported languages.
|
||||
hq string Appends the specified query terms to the query, as if they were combined with a logical AND operator.
|
||||
imgColorType string Returns black and white, grayscale, or color images: mono, gray, and color.
|
||||
|
||||
Acceptable values are:
|
||||
"color": color
|
||||
"gray": gray
|
||||
"mono": mono
|
||||
imgDominantColor string Returns images of a specific dominant color.
|
||||
|
||||
Acceptable values are:
|
||||
"black": black
|
||||
"blue": blue
|
||||
"brown": brown
|
||||
"gray": gray
|
||||
"green": green
|
||||
"pink": pink
|
||||
"purple": purple
|
||||
"teal": teal
|
||||
"white": white
|
||||
"yellow": yellow
|
||||
imgSize string Returns images of a specified size.
|
||||
|
||||
Acceptable values are:
|
||||
"huge": huge
|
||||
"icon": icon
|
||||
"large": large
|
||||
"medium": medium
|
||||
"small": small
|
||||
"xlarge": xlarge
|
||||
"xxlarge": xxlarge
|
||||
imgType string Returns images of a type.
|
||||
|
||||
Acceptable values are:
|
||||
"clipart": clipart
|
||||
"face": face
|
||||
"lineart": lineart
|
||||
"news": news
|
||||
"photo": photo
|
||||
linkSite string Specifies that all search results should contain a link to a particular URL
|
||||
lowRange string Specifies the starting value for a search range.
|
||||
Use lowRange and highRange to append an inclusive search range of lowRange...highRange to the query.
|
||||
lr string Restricts the search to documents written in a particular language (e.g., lr=lang_ja).
|
||||
|
||||
Acceptable values are:
|
||||
"lang_ar": Arabic
|
||||
"lang_bg": Bulgarian
|
||||
"lang_ca": Catalan
|
||||
"lang_cs": Czech
|
||||
"lang_da": Danish
|
||||
"lang_de": German
|
||||
"lang_el": Greek
|
||||
"lang_en": English
|
||||
"lang_es": Spanish
|
||||
"lang_et": Estonian
|
||||
"lang_fi": Finnish
|
||||
"lang_fr": French
|
||||
"lang_hr": Croatian
|
||||
"lang_hu": Hungarian
|
||||
"lang_id": Indonesian
|
||||
"lang_is": Icelandic
|
||||
"lang_it": Italian
|
||||
"lang_iw": Hebrew
|
||||
"lang_ja": Japanese
|
||||
"lang_ko": Korean
|
||||
"lang_lt": Lithuanian
|
||||
"lang_lv": Latvian
|
||||
"lang_nl": Dutch
|
||||
"lang_no": Norwegian
|
||||
"lang_pl": Polish
|
||||
"lang_pt": Portuguese
|
||||
"lang_ro": Romanian
|
||||
"lang_ru": Russian
|
||||
"lang_sk": Slovak
|
||||
"lang_sl": Slovenian
|
||||
"lang_sr": Serbian
|
||||
"lang_sv": Swedish
|
||||
"lang_tr": Turkish
|
||||
"lang_zh-CN": Chinese (Simplified)
|
||||
"lang_zh-TW": Chinese (Traditional)
|
||||
|
||||
orTerms string Provides additional search terms to check for in a document, where each document in the search results must contain at least one of the additional search terms.
|
||||
relatedSite string Specifies that all search results should be pages that are related to the specified URL.
|
||||
rights string Filters based on licensing. Supported values include: cc_publicdomain, cc_attribute, cc_sharealike, cc_noncommercial, cc_nonderived, and combinations of these.
|
||||
safe string Search safety level.
|
||||
|
||||
Acceptable values are:
|
||||
"high": Enables highest level of SafeSearch filtering.
|
||||
"medium": Enables moderate SafeSearch filtering.
|
||||
"off": Disables SafeSearch filtering. (default)
|
||||
searchType string Specifies the search type: image. If unspecified, results are limited to webpages.
|
||||
|
||||
Acceptable values are:
|
||||
"image": custom image search.
|
||||
siteSearch string Specifies all search results should be pages from a given site.
|
||||
siteSearchFilter string Controls whether to include or exclude results from the site named in the siteSearch parameter.
|
||||
|
||||
Acceptable values are:
|
||||
"e": exclude
|
||||
"i": include
|
||||
sort string The sort expression to apply to the results.
|
||||
]"
|
||||
date: "$Date: 2015-10-08 07:51:29 -0300 (ju., 08 oct. 2015) $"
|
||||
revision: "$Revision: 97966 $"
|
||||
EIS: "GCSE parameters", "src=https://developers.google.com/custom-search/json-api/v1/reference/cse/list", "protocol=URI"
|
||||
|
||||
class
|
||||
GCSE_QUERY_PARAMETERS
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_secret_key, a_cx, a_query: READABLE_STRING_8)
|
||||
-- Create an object GCSE_QUERY_PARAMETERS with secret key `a_secret_key' and a custom search engine id `a_cx'.
|
||||
-- and query `a_query'.
|
||||
do
|
||||
-- TODO
|
||||
-- At the moment the API only use cx as Google Custom Search id.
|
||||
-- Custom search engine ID - Use either cx or cref to specify the custom search engine you want to use to perform this search
|
||||
|
||||
secret := a_secret_key
|
||||
cx := a_cx
|
||||
query := a_query
|
||||
ensure
|
||||
secret_set: secret.same_string (a_secret_key)
|
||||
cx_set: cx.same_string (a_cx)
|
||||
query_set: query.same_string (a_query)
|
||||
end
|
||||
|
||||
feature -- Access : Required Parameters
|
||||
|
||||
secret: READABLE_STRING_8
|
||||
-- Required. The shared key between your site and Google Custom Search Engine.
|
||||
|
||||
cx: READABLE_STRING_8
|
||||
-- Custom search engine id to perform this search.
|
||||
|
||||
query: READABLE_STRING_8
|
||||
-- Search query, query parameter to specify your search expression.
|
||||
|
||||
feature -- Optional Parameters
|
||||
|
||||
|
||||
|
||||
num : detachable STRING_8
|
||||
-- Number of search results to return.
|
||||
-- Valid values are integers between 1 and 10, inclusive.
|
||||
|
||||
start: detachable STRING_8
|
||||
-- The index of the first result to return.
|
||||
|
||||
|
||||
feature -- Change Elements
|
||||
|
||||
set_num (a_num: READABLE_STRING_8)
|
||||
require
|
||||
is_number: a_num.is_integer
|
||||
valid_range: a_num.to_integer >= 1 and then a_num.to_integer <= 10
|
||||
do
|
||||
num := a_num
|
||||
ensure
|
||||
num_set: num = a_num
|
||||
valid_rage_set: attached num as l_num and then l_num.to_integer >= 1 and then l_num.to_integer <= 10
|
||||
end
|
||||
|
||||
|
||||
set_start (a_start: READABLE_STRING_8)
|
||||
require
|
||||
is_number: a_start.is_integer
|
||||
valid_start: a_start.to_integer >= 1
|
||||
do
|
||||
start := a_start
|
||||
ensure
|
||||
start_set: start = a_start
|
||||
valid_start_set: attached start as l_start and then l_start.to_integer >= 1
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2015 Javier Velilla, 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
|
||||
115
library/gcse/src/gcse_response.e
Normal file
115
library/gcse/src/gcse_response.e
Normal file
@@ -0,0 +1,115 @@
|
||||
note
|
||||
description: "[
|
||||
Represent search request metadata
|
||||
URL: search template used for the current results.
|
||||
Queries: current, next and previous page.
|
||||
Context
|
||||
Search infromation
|
||||
Items: array of actual search results.
|
||||
]"
|
||||
date: "$Date: 2015-10-08 07:51:29 -0300 (ju., 08 oct. 2015) $"
|
||||
revision: "$Revision: 97966 $"
|
||||
|
||||
class
|
||||
GCSE_RESPONSE
|
||||
|
||||
--! TODO
|
||||
--! All suppport for for url, context and search information.
|
||||
|
||||
feature -- Access
|
||||
|
||||
current_page: detachable GCSE_PAGE
|
||||
-- Metadata describing the query for the current set of results.
|
||||
-- This role is always present in the response.
|
||||
-- It is always an array with just one element.
|
||||
|
||||
next_page: detachable GCSE_PAGE
|
||||
-- Metadata describing the query to use for the next page of results.
|
||||
-- This role is not present if the current results are the last page. Note: This API returns up to the first 100 results only.
|
||||
-- When present, it is always a array with just one element.
|
||||
|
||||
previous_page: detachable GCSE_PAGE
|
||||
-- Metadata describing the query to use for the previous page of results.
|
||||
-- Not present if the current results are the first page.
|
||||
-- When present, it is always a array with just one element.
|
||||
|
||||
items: detachable LIST [GCSE_PAGE_ITEM]
|
||||
-- Contains the actual search results. The search results include the URL, title and text snippets that describe the result.
|
||||
|
||||
feature -- Change Element
|
||||
|
||||
set_current_page (a_page: GCSE_PAGE)
|
||||
-- Set `current_page' with `a_page'.
|
||||
do
|
||||
current_page := a_page
|
||||
ensure
|
||||
current_page_set: current_page = a_page
|
||||
end
|
||||
|
||||
set_next_page (a_page: GCSE_PAGE)
|
||||
-- Set `next_page' with `a_page'.
|
||||
do
|
||||
next_page := a_page
|
||||
ensure
|
||||
next_page_set: next_page = a_page
|
||||
end
|
||||
|
||||
set_previous_page (a_page: GCSE_PAGE)
|
||||
-- Set `previous_page' with `a_page'.
|
||||
do
|
||||
previous_page := a_page
|
||||
ensure
|
||||
previous_page_set: previous_page = a_page
|
||||
end
|
||||
|
||||
add_item (a_item: GCSE_PAGE_ITEM)
|
||||
-- Add item `a_item' to the list of items.
|
||||
local
|
||||
l_items: like items
|
||||
do
|
||||
l_items := items
|
||||
if l_items = Void then
|
||||
create {ARRAYED_LIST[GCSE_PAGE_ITEM]}l_items.make (10)
|
||||
items := l_items
|
||||
end
|
||||
l_items.force (a_item)
|
||||
end
|
||||
|
||||
|
||||
feature -- Acess: HTTP Response
|
||||
|
||||
status: INTEGER
|
||||
-- HTTP status code.
|
||||
|
||||
status_message: detachable READABLE_STRING_8
|
||||
-- associated textual phrase for the response status.
|
||||
|
||||
feature -- Change Element: HTTP Response
|
||||
|
||||
set_status (a_status: like status)
|
||||
-- Set `status' with `a_status'.
|
||||
do
|
||||
status := a_status
|
||||
ensure
|
||||
status_set: status = a_status
|
||||
end
|
||||
|
||||
set_status_nessage (a_message: like status_message)
|
||||
-- Set `status_message' with `a_message'.
|
||||
do
|
||||
status_message := a_message
|
||||
ensure
|
||||
status_message_set: status_message = a_message
|
||||
end
|
||||
|
||||
;note
|
||||
copyright: "2011-2015 Javier Velilla, 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
|
||||
80
library/gcse/test/application.e
Normal file
80
library/gcse/test/application.e
Normal file
@@ -0,0 +1,80 @@
|
||||
note
|
||||
description : "test application root class"
|
||||
date : "$Date: 2015-10-08 07:51:29 -0300 (ju., 08 oct. 2015) $"
|
||||
revision : "$Revision: 97966 $"
|
||||
|
||||
class
|
||||
APPLICATION
|
||||
|
||||
inherit
|
||||
ARGUMENTS
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
-- Run application.
|
||||
local
|
||||
gcse: GCSE_API
|
||||
l_parameters: GCSE_QUERY_PARAMETERS
|
||||
do
|
||||
create l_parameters.make (key, cx, "scoop")
|
||||
create gcse.make (l_parameters)
|
||||
gcse.search
|
||||
|
||||
if attached {GCSE_RESPONSE} gcse.last_result as l_result then
|
||||
if attached l_result.current_page as l_page then
|
||||
print ("Current Page%N")
|
||||
print (l_page.to_string)
|
||||
end
|
||||
if attached l_result.next_page as l_page then
|
||||
print ("Next Page%N")
|
||||
print (l_page.to_string)
|
||||
end
|
||||
if attached l_result.previous_page as l_page then
|
||||
print ("Previous Page%N")
|
||||
print (l_page.to_string)
|
||||
end
|
||||
|
||||
if attached l_result.items as l_items then
|
||||
print ("Number of items:" + l_items.count.out)
|
||||
across l_items as ic loop print (ic.item.to_string) end
|
||||
end
|
||||
|
||||
if attached l_result.next_page as l_page then
|
||||
l_parameters.set_start (l_page.start_index.out)
|
||||
gcse.search
|
||||
end
|
||||
end
|
||||
|
||||
if attached {GCSE_RESPONSE} gcse.last_result as l_result then
|
||||
if attached l_result.current_page as l_page then
|
||||
print ("Current Page%N")
|
||||
print (l_page.to_string)
|
||||
end
|
||||
if attached l_result.next_page as l_page then
|
||||
print ("Next Page%N")
|
||||
print (l_page.to_string)
|
||||
end
|
||||
if attached l_result.previous_page as l_page then
|
||||
print ("Previous Page%N")
|
||||
print (l_page.to_string)
|
||||
end
|
||||
|
||||
if attached l_result.items as l_items then
|
||||
print ("Number of items:" + l_items.count.out)
|
||||
across l_items as ic loop print (ic.item.to_string) end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
Key: STRING = "AIzaSyBKAXNofo-RqZb6kUmpbiCwPEy7n7-E51k"
|
||||
cx : STRING = "015017565055626880074:9gdgp1fvt-g"
|
||||
end
|
||||
31
library/gcse/test/gcse_api_test_set.e
Normal file
31
library/gcse/test/gcse_api_test_set.e
Normal file
@@ -0,0 +1,31 @@
|
||||
note
|
||||
description: "[
|
||||
Eiffel tests that can be executed by testing tool.
|
||||
]"
|
||||
author: "EiffelStudio test wizard"
|
||||
date: "$Date: 2015-10-08 07:51:29 -0300 (ju., 08 oct. 2015) $"
|
||||
revision: "$Revision: 97966 $"
|
||||
testing: "type/manual"
|
||||
|
||||
class
|
||||
GCSE_API_TEST_SET
|
||||
|
||||
inherit
|
||||
EQA_TEST_SET
|
||||
|
||||
feature -- Test routines
|
||||
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
has_error (l_captcha: GCSE_API; a_error: READABLE_STRING_32): BOOLEAN
|
||||
do
|
||||
if attached l_captcha.errors as l_errors then
|
||||
l_errors.compare_objects
|
||||
Result := l_errors.has (a_error)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
21
library/gcse/test/test.ecf
Normal file
21
library/gcse/test/test.ecf
Normal file
@@ -0,0 +1,21 @@
|
||||
<?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="test">
|
||||
<target name="test">
|
||||
<root class="APPLICATION" feature="make"/>
|
||||
<option warning="true" void_safety="transitional">
|
||||
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
|
||||
</option>
|
||||
<setting name="console_application" value="true"/>
|
||||
<precompile name="base_pre" location="$ISE_PRECOMP\base-safe.ecf"/>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||
<library name="gcse" location="..\gcse-safe.ecf" readonly="false"/>
|
||||
<library name="testing" location="$ISE_LIBRARY\library\testing\testing-safe.ecf"/>
|
||||
<cluster name="test" location=".\" recursive="true">
|
||||
<file_rule>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
<exclude>/CVS$</exclude>
|
||||
<exclude>/.svn$</exclude>
|
||||
</file_rule>
|
||||
</cluster>
|
||||
</target>
|
||||
</system>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user