Merge branch 'master' into es_17_01
This commit is contained in:
@@ -36,6 +36,7 @@
|
||||
<library name="cms_openid_module" location="..\..\modules\openid\openid.ecf" readonly="false"/>
|
||||
<library name="cms_recent_changes_module" location="..\..\modules\recent_changes\recent_changes.ecf" readonly="false"/>
|
||||
<library name="cms_seo_module" location="..\..\modules\seo\seo.ecf" readonly="false"/>
|
||||
<library name="cms_sitemap_module" location="..\..\modules\sitemap\sitemap.ecf" readonly="false"/>
|
||||
<library name="cms_session_auth_module" location="..\..\modules\session_auth\cms_session_auth.ecf" readonly="false"/>
|
||||
<library name="cms_taxnomy_module" location="..\..\modules\taxonomy\taxonomy.ecf" readonly="false"/>
|
||||
<library name="cms_wikitext_module" location="..\..\modules\wikitext\wikitext.ecf" readonly="false"/>
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
"openid": { "location": "../../modules/openid" },
|
||||
"recent_changes": { "location": "../../modules/recent_changes" },
|
||||
"seo": { "location": "../../modules/seo" },
|
||||
"sitemap": { "location": "../../modules/sitemap" },
|
||||
"session_auth": { "location": "../../modules/session_auth" },
|
||||
"taxonomy": { "location": "../../modules/taxonomy" },
|
||||
"files": { "location": "../../modules/files" },
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
<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" value="{$cms_search_query/}" >
|
||||
<input type="search" class="form-control" name="q" id="gcse_search" placeholder="search" value="{htmlentities}{$cms_search_query/}{/htmlentities}" >
|
||||
<span class="glyphicon glyphicon-search form-control-feedback"></span>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -68,6 +68,7 @@ feature -- CMS modules
|
||||
|
||||
-- Misc
|
||||
a_setup.register_module (create {CMS_SEO_MODULE}.make)
|
||||
a_setup.register_module (create {CMS_SITEMAP_MODULE}.make)
|
||||
a_setup.register_module (create {CMS_COMMENTS_MODULE}.make)
|
||||
|
||||
-- Taxonomy
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
<library name="cms_model" location="..\..\library\model\cms_model.ecf" readonly="false"/>
|
||||
<library name="cms_comments_module" location="..\..\modules\comments\comments.ecf" readonly="false"/>
|
||||
<library name="cms_recent_changes_module" location="..\..\modules\recent_changes\recent_changes.ecf" readonly="false"/>
|
||||
<library name="cms_sitemap_module" location="..\..\modules\sitemap\sitemap.ecf" readonly="false"/>
|
||||
<library name="cms_taxonomy_module" location="..\..\modules\taxonomy\taxonomy.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"/>
|
||||
|
||||
71
modules/sitemap/cms_sitemap.e
Normal file
71
modules/sitemap/cms_sitemap.e
Normal file
@@ -0,0 +1,71 @@
|
||||
note
|
||||
description: "Container of sitemap items."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CMS_SITEMAP
|
||||
|
||||
inherit
|
||||
ITERABLE [CMS_SITEMAP_ITEM]
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature -- Initialization
|
||||
|
||||
make (a_date: DATE_TIME)
|
||||
do
|
||||
create items.make (100)
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
items: ARRAYED_LIST [CMS_SITEMAP_ITEM]
|
||||
-- List of sitemap entries.
|
||||
|
||||
count: INTEGER
|
||||
-- Number of change items.
|
||||
do
|
||||
Result := items.count
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
new_cursor: ITERATION_CURSOR [CMS_SITEMAP_ITEM]
|
||||
-- <Precursor>
|
||||
do
|
||||
Result := items.new_cursor
|
||||
end
|
||||
|
||||
feature -- Change
|
||||
|
||||
force (a_item: CMS_SITEMAP_ITEM)
|
||||
-- Add `a_item'.
|
||||
do
|
||||
items.force (a_item)
|
||||
end
|
||||
|
||||
feature -- Sorting
|
||||
|
||||
sort
|
||||
-- Sort `items' from older, to newer.
|
||||
do
|
||||
sitemap_item_sorter.sort (items)
|
||||
end
|
||||
|
||||
reverse_sort
|
||||
-- Sort `items' from newer to older.
|
||||
do
|
||||
sitemap_item_sorter.reverse_sort (items)
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
sitemap_item_sorter: QUICK_SORTER [CMS_SITEMAP_ITEM]
|
||||
-- New change item sorter.
|
||||
once
|
||||
create Result.make (create {COMPARABLE_COMPARATOR [CMS_SITEMAP_ITEM]})
|
||||
end
|
||||
|
||||
end
|
||||
19
modules/sitemap/cms_sitemap_hook.e
Normal file
19
modules/sitemap/cms_sitemap_hook.e
Normal file
@@ -0,0 +1,19 @@
|
||||
note
|
||||
description: "Hook provided by module {CMS_RECENT_CHANGES_MODULE}."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
CMS_SITEMAP_HOOK
|
||||
|
||||
inherit
|
||||
CMS_HOOK
|
||||
|
||||
feature -- Invocation
|
||||
|
||||
populate_sitemap (a_sitemap: CMS_SITEMAP)
|
||||
-- Populate `a_sitemap`.
|
||||
deferred
|
||||
end
|
||||
|
||||
end
|
||||
77
modules/sitemap/cms_sitemap_item.e
Normal file
77
modules/sitemap/cms_sitemap_item.e
Normal file
@@ -0,0 +1,77 @@
|
||||
note
|
||||
description: "Information related to sitemap entry."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CMS_SITEMAP_ITEM
|
||||
|
||||
inherit
|
||||
COMPARABLE
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (lnk: CMS_LOCAL_LINK; a_date_time: DATE_TIME)
|
||||
do
|
||||
link := lnk
|
||||
date := a_date_time
|
||||
set_change_frequency_to_weekly
|
||||
priority := 1
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
link: CMS_LOCAL_LINK
|
||||
-- Local link associated with the resource.
|
||||
|
||||
date: DATE_TIME
|
||||
-- Last modification.
|
||||
|
||||
change_frequency: READABLE_STRING_8
|
||||
-- Frequency of changes
|
||||
-- monthly, daily, ...
|
||||
|
||||
priority: NATURAL_8
|
||||
-- Priority
|
||||
|
||||
feature -- Element change
|
||||
|
||||
set_change_frequency_to_monthly
|
||||
do
|
||||
set_change_frequency ("monthly")
|
||||
end
|
||||
|
||||
set_change_frequency_to_weekly
|
||||
do
|
||||
set_change_frequency ("weekly")
|
||||
end
|
||||
|
||||
set_change_frequency_to_daily
|
||||
do
|
||||
set_change_frequency ("daily")
|
||||
end
|
||||
|
||||
set_change_frequency (freq: like change_frequency)
|
||||
-- Set `change_frequency' to `freq'.
|
||||
do
|
||||
change_frequency := freq
|
||||
end
|
||||
|
||||
set_priority (p: like priority)
|
||||
-- Set `priority' to `p'.
|
||||
do
|
||||
priority := p
|
||||
end
|
||||
|
||||
feature -- Comparison
|
||||
|
||||
is_less alias "<" (other: like Current): BOOLEAN
|
||||
-- <Precursor>
|
||||
do
|
||||
Result := date < other.date
|
||||
end
|
||||
|
||||
end
|
||||
185
modules/sitemap/cms_sitemap_module.e
Normal file
185
modules/sitemap/cms_sitemap_module.e
Normal file
@@ -0,0 +1,185 @@
|
||||
note
|
||||
description: "CMS module that brings support for recent changes."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CMS_SITEMAP_MODULE
|
||||
|
||||
inherit
|
||||
CMS_MODULE
|
||||
rename
|
||||
module_api as sitemap_api
|
||||
redefine
|
||||
permissions
|
||||
end
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
-- Create Current module, disabled by default.
|
||||
do
|
||||
version := "1.0"
|
||||
description := "Service to build sitemap"
|
||||
package := "seo"
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
name: STRING = "sitemap"
|
||||
|
||||
permissions: LIST [READABLE_STRING_8]
|
||||
-- List of permission ids, used by this module, and declared.
|
||||
do
|
||||
Result := Precursor
|
||||
Result.force ("admin sitemap")
|
||||
end
|
||||
|
||||
feature -- Access: router
|
||||
|
||||
setup_router (a_router: WSF_ROUTER; a_api: CMS_API)
|
||||
-- <Precursor>
|
||||
do
|
||||
a_router.handle ("/sitemap.xml", create {WSF_URI_AGENT_HANDLER}.make (agent handle_sitemp_xml (a_api, ?, ?)), a_router.methods_head_get)
|
||||
end
|
||||
|
||||
feature -- Hook
|
||||
|
||||
sitemap (a_response: CMS_RESPONSE): CMS_SITEMAP
|
||||
local
|
||||
l_user: detachable CMS_USER
|
||||
-- lnk: FEED_LINK
|
||||
-- nb: NATURAL_32
|
||||
-- s: STRING_32
|
||||
do
|
||||
l_user := Void -- Public access for the feed!
|
||||
create Result.make (create {DATE_TIME}.make_now_utc)
|
||||
if attached a_response.api.hooks.subscribers ({CMS_SITEMAP_HOOK}) as lst then
|
||||
across
|
||||
lst as ic
|
||||
loop
|
||||
if attached {CMS_SITEMAP_HOOK} ic.item as h then
|
||||
h.populate_sitemap (Result)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- create l_feed.make ("CMS Recent changes")
|
||||
-- l_feed.set_date (create {DATE_TIME}.make_now_utc)
|
||||
-- nb := a_size
|
||||
-- across
|
||||
-- l_changes as ic
|
||||
-- until
|
||||
-- nb = 0
|
||||
-- loop
|
||||
-- ch := ic.item
|
||||
-- create l_feed_item.make (ch.link.title)
|
||||
-- l_feed_item.set_date (ch.date)
|
||||
--
|
||||
-- create s.make_empty
|
||||
-- if attached ch.information as l_information then
|
||||
-- s.append (l_information)
|
||||
-- end
|
||||
-- if attached ch.summary as sum then
|
||||
-- if not s.is_empty then
|
||||
-- s.append ("%N%N")
|
||||
-- end
|
||||
-- s.append (sum)
|
||||
-- end
|
||||
-- l_feed_item.set_description (s)
|
||||
-- if attached ch.categories as lst then
|
||||
-- across
|
||||
-- lst as cats_ic
|
||||
-- loop
|
||||
-- l_feed_item.set_category (cats_ic.item)
|
||||
-- end
|
||||
-- end
|
||||
-- create lnk.make (a_response.absolute_url (ch.link.location, Void))
|
||||
-- l_feed_item.links.force (lnk, "")
|
||||
-- l_feed.extend (l_feed_item)
|
||||
-- nb := nb - 1
|
||||
-- end
|
||||
-- l_feed.sort
|
||||
-- Result := l_feed
|
||||
end
|
||||
|
||||
feature -- Handler
|
||||
|
||||
handle_sitemp_xml (api: CMS_API; req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
local
|
||||
r: CMS_RESPONSE
|
||||
-- htdate: HTTP_DATE
|
||||
mesg: CMS_CUSTOM_RESPONSE_MESSAGE
|
||||
l_xml: STRING
|
||||
l_cache: CMS_FILE_STRING_8_CACHE
|
||||
do
|
||||
create {GENERIC_VIEW_CMS_RESPONSE} r.make (req, res, api)
|
||||
create l_cache.make (api.files_location.extended ("sitemap.xml"))
|
||||
if
|
||||
l_cache.exists and then
|
||||
not l_cache.expired (Void, 7*24*60*60) and then
|
||||
attached l_cache.item as l_cached_xml
|
||||
then
|
||||
create mesg.make ({HTTP_STATUS_CODE}.ok)
|
||||
mesg.header.put_content_type ("application/xml")
|
||||
mesg.set_payload (l_cached_xml)
|
||||
res.send (mesg)
|
||||
elseif attached sitemap (r) as l_sitemap then
|
||||
create l_xml.make (1_024)
|
||||
l_xml.append ("<?xml version=%"1.0%" encoding=%"utf-8%"?>%N")
|
||||
l_xml.append ("<?xml-stylesheet type=%"text/xsl%" href=%"http://geyssans.fr/wp-content/plugins/google-sitemap-plugin/sitemap.xsl%"?>%N")
|
||||
l_xml.append ("<urlset xmlns=%"http://www.sitemaps.org/schemas/sitemap/0.9%">%N")
|
||||
across
|
||||
l_sitemap as ic
|
||||
loop
|
||||
l_xml.append ("<url>%N")
|
||||
l_xml.append (" <loc>" + r.absolute_url (ic.item.link.location, Void) + "</loc>%N")
|
||||
l_xml.append (" <lastmod>"); append_date_output (ic.item.date, l_xml); l_xml.append ("</lastmod>%N")
|
||||
l_xml.append (" <changefreq>" + ic.item.change_frequency + "</changefreq>%N")
|
||||
l_xml.append (" <priority>" + ic.item.priority.out + "</priority>%N")
|
||||
l_xml.append ("</url>%N")
|
||||
end
|
||||
l_xml.append ("</urlset>%N")
|
||||
l_cache.put (l_xml)
|
||||
|
||||
create mesg.make ({HTTP_STATUS_CODE}.ok)
|
||||
mesg.header.put_content_type ("application/xml")
|
||||
mesg.header.put_header ("Accept-Ranges: bytes")
|
||||
mesg.header.put_header ("Vary: Accept-Encoding,User-Agent")
|
||||
mesg.set_payload (l_xml)
|
||||
res.send (mesg)
|
||||
else
|
||||
create {NOT_FOUND_ERROR_CMS_RESPONSE} r.make (req, res, api)
|
||||
r.execute
|
||||
end
|
||||
end
|
||||
|
||||
append_date_output (dt: DATE_TIME; a_output: STRING)
|
||||
--| 2017-02-07T21:09:21+00:00
|
||||
do
|
||||
a_output.append_integer (dt.year)
|
||||
a_output.append_character ('-')
|
||||
append_two_digits_integer (dt.month, a_output)
|
||||
a_output.append_character ('-')
|
||||
append_two_digits_integer (dt.day, a_output)
|
||||
a_output.append_character ('T')
|
||||
append_two_digits_integer (dt.hour, a_output)
|
||||
a_output.append_character (':')
|
||||
append_two_digits_integer (dt.minute, a_output)
|
||||
a_output.append_character (':')
|
||||
append_two_digits_integer (dt.second, a_output)
|
||||
a_output.append_string ("+00:00")
|
||||
end
|
||||
|
||||
append_two_digits_integer (i: INTEGER; s: STRING_8)
|
||||
do
|
||||
if i < 10 then
|
||||
s.append_character ('0')
|
||||
end
|
||||
s.append_integer (i)
|
||||
end
|
||||
|
||||
end
|
||||
3
modules/sitemap/sitemap-safe.ecf
Normal file
3
modules/sitemap/sitemap-safe.ecf
Normal file
@@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<redirection xmlns="http://www.eiffel.com/developers/xml/configuration-1-16-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-16-0 http://www.eiffel.com/developers/xml/configuration-1-16-0.xsd" uuid="B49AE1E5-E120-4535-8FBA-817F36315268" message="Obsolete: use sitemap.ecf !" location="sitemap.ecf">
|
||||
</redirection>
|
||||
23
modules/sitemap/sitemap.ecf
Normal file
23
modules/sitemap/sitemap.ecf
Normal file
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-16-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-16-0 http://www.eiffel.com/developers/xml/configuration-1-16-0.xsd" name="sitemap" uuid="B49AE1E5-E120-4535-8FBA-817F36315268" library_target="sitemap">
|
||||
<target name="sitemap">
|
||||
<root all_classes="true"/>
|
||||
<file_rule>
|
||||
<exclude>/.svn$</exclude>
|
||||
<exclude>/CVS$</exclude>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
</file_rule>
|
||||
<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" location="..\..\cms.ecf"/>
|
||||
<library name="cms_model" location="..\..\library\model\cms_model.ecf" readonly="false"/>
|
||||
<library name="error" location="$ISE_LIBRARY\contrib\library\utility\general\error\error.ecf"/>
|
||||
<library name="feed" location="$ISE_LIBRARY\contrib\library\text\parser\feed\feed.ecf"/>
|
||||
<library name="http" location="$ISE_LIBRARY\contrib\library\network\protocol\http\http.ecf"/>
|
||||
<library name="time" location="$ISE_LIBRARY\library\time\time.ecf"/>
|
||||
<library name="wsf" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf.ecf"/>
|
||||
<library name="wsf_extension" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf\wsf_extension.ecf" readonly="false"/>
|
||||
<library name="wsf_html" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\wsf_html\wsf_html.ecf" readonly="false"/>
|
||||
<cluster name="src" location=".\" recursive="true"/>
|
||||
</target>
|
||||
</system>
|
||||
Reference in New Issue
Block a user