Cleaned demo.ecf

Fixed modules admin handler permission checking from "admin.installation_access" to "administration.installation_access".
Use constants for known form id.
Invoke hook form alter for user view response.
Include theme when installing roc cms library.
This commit is contained in:
Jocelyn Fiat
2017-09-11 22:31:23 +02:00
parent 5f7eb82def
commit 6b4668ec6b
11 changed files with 209 additions and 18 deletions

View File

@@ -42,6 +42,11 @@
<library name="embedded_video_module" location="..\..\modules\embedded_video\embedded_video.ecf" readonly="false"/> <library name="embedded_video_module" location="..\..\modules\embedded_video\embedded_video.ecf" readonly="false"/>
<library name="masquerade_auth_module" location="..\..\dev_modules\masquerade_auth\masquerade_auth.ecf" readonly="false"/> <library name="masquerade_auth_module" location="..\..\dev_modules\masquerade_auth\masquerade_auth.ecf" readonly="false"/>
<library name="persistence_sqlite3" location="..\..\library\persistence\sqlite3\sqlite3.ecf" readonly="false"/> <library name="persistence_sqlite3" location="..\..\library\persistence\sqlite3\sqlite3.ecf" readonly="false"/>
<!--
By default, commented, since it depends on specific environment settings.
<library name="persistence_store_odbc" location="..\..\library\persistence\store_odbc\store_odbc.ecf"/>
<library name="persistence_store_mysql" location="..\..\library\persistence\store_mysql\store_mysql.ecf" />
-->
<library name="wsf" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf.ecf"/> <library name="wsf" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf.ecf"/>
<library name="wsf_extension" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf_extension.ecf" readonly="false"/> <library name="wsf_extension" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf_extension.ecf" readonly="false"/>
</target> </target>
@@ -53,34 +58,28 @@
<cluster name="src" location=".\src\" recursive="true"/> <cluster name="src" location=".\src\" recursive="true"/>
</target> </target>
<target name="demo_standalone" extends="common"> <target name="demo_standalone" extends="common">
<option debug="true">
<debug name="dbglog" enabled="true"/>
</option>
<capability>
<concurrency support="scoop" use="scoop"/>
</capability>
<variable name="httpd_ssl_disabled" value="true"/> <variable name="httpd_ssl_disabled" value="true"/>
<library name="standalone_launcher" location="..\..\launcher\standalone.ecf" readonly="false"/> <library name="standalone_launcher" location="..\..\launcher\standalone.ecf" readonly="false"/>
<cluster name="src" location=".\src\" recursive="true"/> <cluster name="src" location=".\src\" recursive="true"/>
</target> </target>
<target name="demo_standalone_none" extends="demo_standalone"> <target name="demo_standalone_none" extends="demo_standalone">
<capability> <capability>
<concurrency support="none" use="none"/> <concurrency use="none"/>
</capability> </capability>
</target> </target>
<target name="demo_standalone_mt" extends="demo_standalone"> <target name="demo_standalone_mt" extends="demo_standalone">
<capability> <capability>
<concurrency support="thread" use="thread"/> <concurrency use="thread"/>
</capability> </capability>
</target> </target>
<target name="demo_standalone_scoop" extends="demo_standalone"> <target name="demo_standalone_scoop" extends="demo_standalone">
<capability> <capability>
<concurrency support="scoop" use="scoop"/> <concurrency use="scoop"/>
</capability> </capability>
</target> </target>
<target name="demo_standalone_scoop_ssl" extends="demo_standalone_scoop"> <target name="demo_standalone_scoop_ssl" extends="demo_standalone_scoop">
<capability> <capability>
<concurrency support="scoop" use="scoop"/> <concurrency use="scoop"/>
</capability> </capability>
<variable name="httpd_ssl_enabled" value="true"/> <variable name="httpd_ssl_enabled" value="true"/>
<variable name="libcurl_http_client_disabled" value="true"/> <variable name="libcurl_http_client_disabled" value="true"/>
@@ -89,14 +88,14 @@
</target> </target>
<target name="demo_cgi" extends="common"> <target name="demo_cgi" extends="common">
<capability> <capability>
<concurrency support="none" use="none"/> <concurrency use="none"/>
</capability> </capability>
<library name="cgi_launcher" location="..\..\launcher\cgi.ecf" readonly="false"/> <library name="cgi_launcher" location="..\..\launcher\cgi.ecf" readonly="false"/>
<cluster name="src" location=".\src\" recursive="true"/> <cluster name="src" location=".\src\" recursive="true"/>
</target> </target>
<target name="demo_libfcgi" extends="common"> <target name="demo_libfcgi" extends="common">
<capability> <capability>
<concurrency support="none" use="none"/> <concurrency use="none"/>
</capability> </capability>
<library name="libfcgi_launcher" location="..\..\launcher\libfcgi.ecf" readonly="false"/> <library name="libfcgi_launcher" location="..\..\launcher\libfcgi.ecf" readonly="false"/>
<cluster name="src" location=".\src\" recursive="true"/> <cluster name="src" location=".\src\" recursive="true"/>

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,8 @@
$(document).ready(function() {
$('#gcse_search_form').submit(function() {
window.open('', 'formpopup', 'width=600,height=600,resizeable,scrollbars');
this.target = 'formpopup';
});
});

View File

@@ -0,0 +1,110 @@
ul.horizontal {
li {
display: inline-block;
}
}
#header {
#primary.menu {
ul {
li {
color: #555;
a {
color: #555;
text-decoration: none;
&:hover { color: black; }
}
background-color: #fff;
padding: 10px;
margin: 0;
}
&.horizontal {
border-bottom: solid 1px #ddd;
li {
border-top: solid 3px #fff;
&:hover {
background-color: #ffe;
border-top: solid 3px #999;
}
&.active {
font-weight: bold;
border-top: solid 3px #ddd;
background-color: #ddd;
}
&.active:hover {
border-top: solid 3px blue;
}
}
}
}
}
}
#content {
margin-left: 20px;
#highlighted {
position: relative;
border: solid 1px #ddd;
background-color: #ffc;
width: 70%;
left: 15%;
right: 15%;
padding: 5px;
font-style: italic;
}
.preview {
border: solid 1px red;
}
}
.sidebar {
padding: 5px;
margin: 3px;
/* border: solid 1px #ccc; */
&#sidebar_first {
width: 250px;
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 {
list-style-type: none;
li {
display: inline;
padding: 2px 5px;
border: solid 1px #ccf;
}
li.active {
border-color: #99f #99f #ddd;
border-style: solid solid none;
border-width: 2px 1px 0;
padding: 2px 7px 1px;
}
}
}
#message li.error {
background-color: #f99;
border: solid 1px red;
padding: 5px 2px 5px 2px;
}
table.with_border {
thead td {
font-weight: bold;
}
td {
border: solid 1px #ccc;
padding: 2px 5px 2px 5px;
}
}

View File

@@ -50,7 +50,7 @@ feature -- Execution
attached {WSF_TABLE} req.query_parameter ("module_uninstallation") as tb attached {WSF_TABLE} req.query_parameter ("module_uninstallation") as tb
then then
create {GENERIC_VIEW_CMS_RESPONSE} r.make (req, res, api) create {GENERIC_VIEW_CMS_RESPONSE} r.make (req, res, api)
if attached api.setup.string_8_item ("admin.installation_access") as l_access then if attached api.setup.string_8_item ("administration.installation_access") as l_access then
if l_access.is_case_insensitive_equal ("none") then if l_access.is_case_insensitive_equal ("none") then
l_denied := True l_denied := True
elseif l_access.is_case_insensitive_equal ("permission") then elseif l_access.is_case_insensitive_equal ("permission") then

View File

@@ -223,6 +223,9 @@ feature -- Handler / Constants
feature -- Handler feature -- Handler
view_account_form_id: STRING = "roccms-user-view"
edit_account_form_id: STRING = "roccms-user-edit"
handle_account (api: CMS_API; req: WSF_REQUEST; res: WSF_RESPONSE) handle_account (api: CMS_API; req: WSF_REQUEST; res: WSF_RESPONSE)
local local
r: CMS_RESPONSE r: CMS_RESPONSE
@@ -235,7 +238,7 @@ feature -- Handler
create {GENERIC_VIEW_CMS_RESPONSE} r.make (req, res, api) create {GENERIC_VIEW_CMS_RESPONSE} r.make (req, res, api)
create b.make_empty create b.make_empty
l_user := r.user l_user := r.user
create f.make (r.location, "roccms-user-view") create f.make (r.location, view_account_form_id)
if attached smarty_template_block (Current, "account_info", api) as l_tpl_block then if attached smarty_template_block (Current, "account_info", api) as l_tpl_block then
l_tpl_block.set_weight (-10) l_tpl_block.set_weight (-10)
r.add_block (l_tpl_block, "content") r.add_block (l_tpl_block, "content")
@@ -301,7 +304,7 @@ feature -- Handler
create {GENERIC_VIEW_CMS_RESPONSE} r.make (req, res, api) create {GENERIC_VIEW_CMS_RESPONSE} r.make (req, res, api)
create b.make_empty create b.make_empty
l_user := r.user l_user := r.user
create l_form.make (r.location, "roccms-user-edit") create l_form.make (r.location, edit_account_form_id)
if attached smarty_template_block (Current, "account_edit", api) as l_tpl_block then if attached smarty_template_block (Current, "account_edit", api) as l_tpl_block then
l_tpl_block.set_weight (-10) l_tpl_block.set_weight (-10)
r.add_block (l_tpl_block, "content") r.add_block (l_tpl_block, "content")

View File

@@ -157,7 +157,7 @@ feature -- Hook
do do
if if
attached a_form.id as fid and then attached a_form.id as fid and then
fid.same_string ("roccms-user-view") fid.same_string ("roccms-user-view") -- Check {CMS_AUTHENTICATION_MODULE}.view_account_form_id
then then
if if
attached a_response.user as u and then attached a_response.user as u and then

View File

@@ -56,6 +56,7 @@ feature -- Process
or l_user.same_as (user) -- Same user or l_user.same_as (user) -- Same user
then then
f := new_view_form (l_user, request.request_uri, "view-user") f := new_view_form (l_user, request.request_uri, "view-user")
api.hooks.invoke_form_alter (f, Void, Current)
f.append_to_html (wsf_theme, b) f.append_to_html (wsf_theme, b)
else else
b.append ("You don't have the permission to view this user!") b.append ("You don't have the permission to view this user!")
@@ -68,6 +69,8 @@ feature -- Process
feature -- Process Edit feature -- Process Edit
view_user_form_id: STRING = "view-user"
new_view_form (a_user: detachable CMS_USER; a_url: READABLE_STRING_8; a_name: STRING): CMS_FORM new_view_form (a_user: detachable CMS_USER; a_url: READABLE_STRING_8; a_name: STRING): CMS_FORM
-- Create a web form named `a_name' for user `a_user' (if set), using form action url `a_url'. -- Create a web form named `a_name' for user `a_user' (if set), using form action url `a_url'.
local local

View File

@@ -29,6 +29,13 @@ feature -- API Service
api: CMS_API api: CMS_API
feature -- Response factory
new_generic_response (req: WSF_REQUEST; res: WSF_RESPONSE): CMS_RESPONSE
do
create {GENERIC_VIEW_CMS_RESPONSE} Result.make (req, res, api)
end
feature -- Response message helpers feature -- Response message helpers
redirect_to (a_location: READABLE_STRING_8; res: WSF_RESPONSE) redirect_to (a_location: READABLE_STRING_8; res: WSF_RESPONSE)

View File

@@ -57,6 +57,7 @@ echo Install ROC as CMS ewf
%SAFE_RMDIR% %TMP_UNSTABLE_DIR%\library\web\cms\dev_modules %SAFE_RMDIR% %TMP_UNSTABLE_DIR%\library\web\cms\dev_modules
%SAFE_RMDIR% %TMP_UNSTABLE_DIR%\library\web\cms\modules %SAFE_RMDIR% %TMP_UNSTABLE_DIR%\library\web\cms\modules
%SAFE_RMDIR% %TMP_UNSTABLE_DIR%\library\web\cms\examples %SAFE_RMDIR% %TMP_UNSTABLE_DIR%\library\web\cms\examples
%SAFE_RMDIR% %TMP_UNSTABLE_DIR%\library\web\cms\themes
%COPYCMD% %TMP_DIR%\launcher %TMP_UNSTABLE_DIR%\library\web\cms\launcher %COPYCMD% %TMP_DIR%\launcher %TMP_UNSTABLE_DIR%\library\web\cms\launcher
%COPYCMD% %TMP_DIR%\library %TMP_UNSTABLE_DIR%\library\web\cms\library %COPYCMD% %TMP_DIR%\library %TMP_UNSTABLE_DIR%\library\web\cms\library
@@ -65,6 +66,7 @@ echo Install ROC as CMS ewf
%COPYCMD% %TMP_DIR%\modules %TMP_UNSTABLE_DIR%\library\web\cms\modules %COPYCMD% %TMP_DIR%\modules %TMP_UNSTABLE_DIR%\library\web\cms\modules
%COPYCMD% %TMP_DIR%\dev_modules %TMP_UNSTABLE_DIR%\library\web\cms\dev_modules %COPYCMD% %TMP_DIR%\dev_modules %TMP_UNSTABLE_DIR%\library\web\cms\dev_modules
%COPYCMD% %TMP_DIR%\examples %TMP_UNSTABLE_DIR%\library\web\cms\examples %COPYCMD% %TMP_DIR%\examples %TMP_UNSTABLE_DIR%\library\web\cms\examples
%COPYCMD% %TMP_DIR%\themes %TMP_UNSTABLE_DIR%\library\web\cms\themes
echo TOOLS echo TOOLS
%COPYCMD% %TMP_DIR%\tools %TMP_UNSTABLE_DIR%\library\web\cms\tools %COPYCMD% %TMP_DIR%\tools %TMP_UNSTABLE_DIR%\library\web\cms\tools
%SAFE_RM% %TMP_UNSTABLE_DIR%\library\web\cms\tools\install.bat %SAFE_RM% %TMP_UNSTABLE_DIR%\library\web\cms\tools\install.bat

View File

@@ -248,6 +248,8 @@ feature -- Execution
end end
end end
end end
elseif l_config_path /= Void then
localized_print_error ({STRING_32} "Unable to read configuration file %"" + l_config_path.name + "%"!%N")
end end
if l_cms_path = Void then if l_cms_path = Void then
@@ -282,7 +284,7 @@ feature -- Execution
print (" in %"") print (" in %"")
print (l_dest_dir.path.name) print (l_dest_dir.path.name)
print ("%":%N") print ("%":%N")
install_module_elements (l_module_source_path, l_dest_dir.path, Void) install_module_elements (l_mod_name, l_module_source_path, l_dest_dir.path, Void)
-- install_module_elements (l_module_source_path, l_dest_dir.path, Config_dir) -- install_module_elements (l_module_source_path, l_dest_dir.path, Config_dir)
-- install_module_elements (l_module_source_path, l_dest_dir.path, Scripts_dir) -- install_module_elements (l_module_source_path, l_dest_dir.path, Scripts_dir)
-- install_module_elements (l_module_source_path, l_dest_dir.path, Themes_dir) -- install_module_elements (l_module_source_path, l_dest_dir.path, Themes_dir)
@@ -350,7 +352,52 @@ feature -- Execution
end end
end end
install_module_elements (a_module_source_path: ROC_INSTALL_COPY_PARAMETERS; a_cms_module_target_path: PATH; a_element: detachable READABLE_STRING_GENERAL) ecf_location (a_module_name: READABLE_STRING_GENERAL; a_module_source_path: ROC_INSTALL_COPY_PARAMETERS): detachable PATH
-- ecf location if exists.
-- Try to find based on `a_module_name`, or dir name from `a_module_source_path`, or .. search unique .ecf file (ignoring -safe.ecf).
local
l_name: READABLE_STRING_GENERAL
p: PATH
ut: FILE_UTILITIES
do
p := a_module_source_path.location
Result := p.extended (a_module_name).appended_with_extension ("ecf")
if ut.file_path_exists (Result) then
-- Found.
else
Result := Void
if attached p.entry as e then
Result := p.extended (e.name).appended_with_extension ("ecf")
if not ut.file_path_exists (Result) then
Result := Void
end
end
if Result = Void then
if attached ut.file_names (p.name) as l_filenames then
across
l_filenames as ic
until
Result /= Void
loop
l_name := ic.item
if l_name.ends_with (".ecf") then
if l_name.ends_with ("-safe.ecf") then
-- Ignore
else
Result := p.extended (l_name)
if not ut.file_path_exists (Result) then
check existing_file: False end
Result := Void
end
end
end
end
end
end
end
end
install_module_elements (a_module_name: READABLE_STRING_GENERAL; a_module_source_path: ROC_INSTALL_COPY_PARAMETERS; a_cms_module_target_path: PATH; a_element: detachable READABLE_STRING_GENERAL)
-- Install module site files from `a_module_source_path' to cms application `a_cms_module_target_path' under expected modules folder. -- Install module site files from `a_module_source_path' to cms application `a_cms_module_target_path' under expected modules folder.
-- If `a_element' is set, take into account only sub folder `a_element'. -- If `a_element' is set, take into account only sub folder `a_element'.
local local
@@ -380,6 +427,12 @@ feature -- Execution
else else
link_directory (l_src_dir, l_dest_dir, True) link_directory (l_src_dir, l_dest_dir, True)
end end
-- Detect ecf file (in the future, update main ecf file).
if attached ecf_location (a_module_name, a_module_source_path) as l_ecf_loc then
-- Found ecf file.
elseif not a_module_name.is_case_insensitive_equal ("core") then
localized_print_error ({STRING_32} "Missing .ecf file for " + a_module_name + "!%N")
end
end end
install_theme_elements (a_theme_source_path: ROC_INSTALL_COPY_PARAMETERS; a_cms_theme_target_path: PATH; a_element: detachable READABLE_STRING_GENERAL) install_theme_elements (a_theme_source_path: ROC_INSTALL_COPY_PARAMETERS; a_cms_theme_target_path: PATH; a_element: detachable READABLE_STRING_GENERAL)