Merge branch 'master' into es_17_01
This commit is contained in:
141
examples/demo/site/modules/sitemap/files/sitemap.xsl
Normal file
141
examples/demo/site/modules/sitemap/files/sitemap.xsl
Normal file
@@ -0,0 +1,141 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsl:stylesheet version="2.0"
|
||||
xmlns:html="http://www.w3.org/TR/REC-html40"
|
||||
xmlns:sitemap="http://www.sitemaps.org/schemas/sitemap/0.9"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
|
||||
<xsl:template match="/">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>XML Sitemap</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<style type="text/css">
|
||||
body {
|
||||
font-family:"Lucida Grande","Lucida Sans Unicode",Tahoma,Verdana;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
#header {
|
||||
text-align: center;
|
||||
padding-top: 14px;
|
||||
padding-bottom: 29px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-weight: normal;
|
||||
font-size: 24px;
|
||||
line-height: 20px;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-weight: normal;
|
||||
font-size: 13px;
|
||||
color: #aaaaaa;
|
||||
line-height: 10px;
|
||||
}
|
||||
|
||||
#content {
|
||||
background: #f8f8f8;
|
||||
border-top: 1px solid #dddddd;
|
||||
padding-top: 50px;
|
||||
}
|
||||
|
||||
#content a:visited,
|
||||
#content tr:hover a:visited {
|
||||
color: #68009c;
|
||||
}
|
||||
|
||||
table {
|
||||
margin: 0 auto;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
tr#table-header:hover {
|
||||
background: none;
|
||||
}
|
||||
|
||||
tr:hover {
|
||||
background: #ebebeb;
|
||||
}
|
||||
|
||||
#content tr:hover a {
|
||||
color: #6e6e6e;
|
||||
}
|
||||
|
||||
td {
|
||||
color: #6e6e6e;
|
||||
font-size: 12px;
|
||||
border-bottom: 1px solid #dddddd;
|
||||
padding: 11px 5px 13px;
|
||||
}
|
||||
|
||||
th {
|
||||
color: #333333;
|
||||
font-size: 12px;
|
||||
border-bottom: 1px solid #dddddd;
|
||||
padding: 5px 50px 17px 5px;
|
||||
}
|
||||
|
||||
#footer {
|
||||
background: #f8f8f8;
|
||||
font-size: 13px;
|
||||
color: #aaaaaa;
|
||||
padding: 54px 0 20px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #2384c6;
|
||||
}
|
||||
a:hover {
|
||||
color: #6e6e6e;
|
||||
text-decoration: none;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="header">
|
||||
<h1>XML Sitemap</h1>
|
||||
<h2>This is a XML Sitemap which is supposed to be processed by <a href="http://www.google.com">Google search engine</a>.</h2>
|
||||
</div>
|
||||
<div id="content">
|
||||
<table cellpadding="5" cellspacing="0">
|
||||
<tr id="table-header">
|
||||
<th>URL</th>
|
||||
<th>Priority</th>
|
||||
<th>Change Frequency</th>
|
||||
<th>LastChange (GMT)</th>
|
||||
</tr>
|
||||
<xsl:variable name="lower" select="'abcdefghijklmnopqrstuvwxyz'"/>
|
||||
<xsl:variable name="upper" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
|
||||
<xsl:for-each select="sitemap:urlset/sitemap:url">
|
||||
<tr>
|
||||
<xsl:if test="position() mod 2 != 1">
|
||||
<xsl:attribute name="class">high</xsl:attribute>
|
||||
</xsl:if>
|
||||
<td>
|
||||
<xsl:variable name="itemURL">
|
||||
<xsl:value-of select="sitemap:loc"/>
|
||||
</xsl:variable>
|
||||
<a href="{$itemURL}">
|
||||
<xsl:value-of select="sitemap:loc"/>
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<xsl:value-of select="concat(sitemap:priority*100,'%')"/>
|
||||
</td>
|
||||
<td>
|
||||
<xsl:value-of select="concat(translate(substring(sitemap:changefreq, 1, 1),concat($lower, $upper),concat($upper, $lower)),substring(sitemap:changefreq, 2))"/>
|
||||
</td>
|
||||
<td>
|
||||
<xsl:value-of select="concat(substring(sitemap:lastmod,0,11),concat(' ', substring(sitemap:lastmod,12,5)))"/>
|
||||
</td>
|
||||
</tr>
|
||||
</xsl:for-each>
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
@@ -25,6 +25,8 @@ inherit
|
||||
|
||||
CMS_RECENT_CHANGES_HOOK
|
||||
|
||||
CMS_SITEMAP_HOOK
|
||||
|
||||
CMS_TAXONOMY_HOOK
|
||||
|
||||
create
|
||||
@@ -40,6 +42,7 @@ feature {NONE} -- Initialization
|
||||
package := "core"
|
||||
-- Optional dependencies, mainly for information.
|
||||
put_dependency ({CMS_RECENT_CHANGES_MODULE}, False)
|
||||
put_dependency ({CMS_SITEMAP_MODULE}, False)
|
||||
put_dependency ({CMS_TAXONOMY_MODULE}, False)
|
||||
end
|
||||
|
||||
@@ -212,6 +215,7 @@ feature -- Hooks
|
||||
|
||||
-- Module specific hook, if available.
|
||||
a_hooks.subscribe_to_hook (Current, {CMS_RECENT_CHANGES_HOOK})
|
||||
a_hooks.subscribe_to_hook (Current, {CMS_SITEMAP_HOOK})
|
||||
a_hooks.subscribe_to_hook (Current, {CMS_TAXONOMY_HOOK})
|
||||
end
|
||||
|
||||
@@ -388,4 +392,21 @@ feature -- Hooks
|
||||
end
|
||||
end
|
||||
|
||||
populate_sitemap (a_sitemap: CMS_SITEMAP)
|
||||
-- Populate `a_sitemap`.
|
||||
local
|
||||
i: CMS_SITEMAP_ITEM
|
||||
n: CMS_NODE
|
||||
do
|
||||
if attached node_api as l_node_api then
|
||||
across
|
||||
l_node_api.nodes as ic -- FIXME: do not load all nodes at once!
|
||||
loop
|
||||
n := ic.item
|
||||
create i.make (l_node_api.node_link (n), n.modification_date)
|
||||
a_sitemap.force (i)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -49,13 +49,7 @@ feature -- Access: router
|
||||
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
|
||||
@@ -66,44 +60,6 @@ feature -- Hook
|
||||
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
|
||||
@@ -111,13 +67,12 @@ 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"))
|
||||
create l_cache.make (api.files_location.extended ("modules").extended ("sitemap").extended ("sitemap.xml"))
|
||||
if
|
||||
l_cache.exists and then
|
||||
not l_cache.expired (Void, 7*24*60*60) and then
|
||||
@@ -130,17 +85,17 @@ feature -- Handler
|
||||
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 ("<?xml-stylesheet type=%"text/xsl%" href=%"" + r.absolute_url ("/module/" + name + "/files/sitemap.xsl", Void) + "%"?>%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")
|
||||
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)
|
||||
|
||||
141
modules/sitemap/site/files/sitemap.xsl
Normal file
141
modules/sitemap/site/files/sitemap.xsl
Normal file
@@ -0,0 +1,141 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsl:stylesheet version="2.0"
|
||||
xmlns:html="http://www.w3.org/TR/REC-html40"
|
||||
xmlns:sitemap="http://www.sitemaps.org/schemas/sitemap/0.9"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
|
||||
<xsl:template match="/">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>XML Sitemap</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<style type="text/css">
|
||||
body {
|
||||
font-family:"Lucida Grande","Lucida Sans Unicode",Tahoma,Verdana;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
#header {
|
||||
text-align: center;
|
||||
padding-top: 14px;
|
||||
padding-bottom: 29px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-weight: normal;
|
||||
font-size: 24px;
|
||||
line-height: 20px;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-weight: normal;
|
||||
font-size: 13px;
|
||||
color: #aaaaaa;
|
||||
line-height: 10px;
|
||||
}
|
||||
|
||||
#content {
|
||||
background: #f8f8f8;
|
||||
border-top: 1px solid #dddddd;
|
||||
padding-top: 50px;
|
||||
}
|
||||
|
||||
#content a:visited,
|
||||
#content tr:hover a:visited {
|
||||
color: #68009c;
|
||||
}
|
||||
|
||||
table {
|
||||
margin: 0 auto;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
tr#table-header:hover {
|
||||
background: none;
|
||||
}
|
||||
|
||||
tr:hover {
|
||||
background: #ebebeb;
|
||||
}
|
||||
|
||||
#content tr:hover a {
|
||||
color: #6e6e6e;
|
||||
}
|
||||
|
||||
td {
|
||||
color: #6e6e6e;
|
||||
font-size: 12px;
|
||||
border-bottom: 1px solid #dddddd;
|
||||
padding: 11px 5px 13px;
|
||||
}
|
||||
|
||||
th {
|
||||
color: #333333;
|
||||
font-size: 12px;
|
||||
border-bottom: 1px solid #dddddd;
|
||||
padding: 5px 50px 17px 5px;
|
||||
}
|
||||
|
||||
#footer {
|
||||
background: #f8f8f8;
|
||||
font-size: 13px;
|
||||
color: #aaaaaa;
|
||||
padding: 54px 0 20px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #2384c6;
|
||||
}
|
||||
a:hover {
|
||||
color: #6e6e6e;
|
||||
text-decoration: none;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="header">
|
||||
<h1>XML Sitemap</h1>
|
||||
<h2>This is a XML Sitemap which is supposed to be processed by <a href="http://www.google.com">Google search engine</a>.</h2>
|
||||
</div>
|
||||
<div id="content">
|
||||
<table cellpadding="5" cellspacing="0">
|
||||
<tr id="table-header">
|
||||
<th>URL</th>
|
||||
<th>Priority</th>
|
||||
<th>Change Frequency</th>
|
||||
<th>LastChange (GMT)</th>
|
||||
</tr>
|
||||
<xsl:variable name="lower" select="'abcdefghijklmnopqrstuvwxyz'"/>
|
||||
<xsl:variable name="upper" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
|
||||
<xsl:for-each select="sitemap:urlset/sitemap:url">
|
||||
<tr>
|
||||
<xsl:if test="position() mod 2 != 1">
|
||||
<xsl:attribute name="class">high</xsl:attribute>
|
||||
</xsl:if>
|
||||
<td>
|
||||
<xsl:variable name="itemURL">
|
||||
<xsl:value-of select="sitemap:loc"/>
|
||||
</xsl:variable>
|
||||
<a href="{$itemURL}">
|
||||
<xsl:value-of select="sitemap:loc"/>
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<xsl:value-of select="concat(sitemap:priority*100,'%')"/>
|
||||
</td>
|
||||
<td>
|
||||
<xsl:value-of select="concat(translate(substring(sitemap:changefreq, 1, 1),concat($lower, $upper),concat($upper, $lower)),substring(sitemap:changefreq, 2))"/>
|
||||
</td>
|
||||
<td>
|
||||
<xsl:value-of select="concat(substring(sitemap:lastmod,0,11),concat(' ', substring(sitemap:lastmod,12,5)))"/>
|
||||
</td>
|
||||
</tr>
|
||||
</xsl:for-each>
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
@@ -28,6 +28,8 @@ feature -- Change
|
||||
|
||||
subscribe_to_hook (h: CMS_HOOK; a_hook_type: TYPE [CMS_HOOK])
|
||||
-- Subscribe `h' to hooks identified by `a_hook_type'.
|
||||
require
|
||||
h_is_expected_hook: a_hook_type.attempted (h) = h
|
||||
local
|
||||
lst: detachable LIST [CMS_HOOK]
|
||||
do
|
||||
@@ -49,7 +51,7 @@ invariant
|
||||
all_subscribers /= Void
|
||||
|
||||
note
|
||||
copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||
copyright: "2011-2017, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
end
|
||||
|
||||
|
||||
@@ -792,14 +792,14 @@ feature -- Environment/ module
|
||||
module_resource_location (a_module: CMS_MODULE; a_resource: PATH): PATH
|
||||
-- Location of resource `a_resource' for `a_module'.
|
||||
do
|
||||
--| site/modules/$modname/$a_name.json
|
||||
--| site/modules/$modname/$a_resource
|
||||
Result := module_resource_location_by_name (a_module.name, a_resource)
|
||||
end
|
||||
|
||||
module_resource_location_by_name (a_module_name: READABLE_STRING_GENERAL; a_resource: PATH): PATH
|
||||
-- Location of resource `a_resource' for `a_module'.
|
||||
do
|
||||
--| site/modules/$modname/$a_name.json
|
||||
--| site/modules/$modname/$a_resource
|
||||
Result := module_location_by_name (a_module_name).extended_path (a_resource)
|
||||
end
|
||||
|
||||
|
||||
@@ -50,12 +50,12 @@ set TMP_CONTRIB_DIR=%TMP_TARGET_DIR%\contrib
|
||||
set TMP_UNSTABLE_DIR=%TMP_TARGET_DIR%\unstable
|
||||
|
||||
echo Install ROC as CMS ewf
|
||||
%SAFE_RMDIR% %TMP_UNSTABLE_DIR%\library\cms\launcher
|
||||
%SAFE_RMDIR% %TMP_UNSTABLE_DIR%\library\cms\library
|
||||
%SAFE_RMDIR% %TMP_UNSTABLE_DIR%\library\cms\src
|
||||
%SAFE_RMDIR% %TMP_UNSTABLE_DIR%\library\cms\doc
|
||||
%SAFE_RMDIR% %TMP_UNSTABLE_DIR%\library\cms\modules
|
||||
%SAFE_RMDIR% %TMP_UNSTABLE_DIR%\library\cms\examples
|
||||
%SAFE_RMDIR% %TMP_UNSTABLE_DIR%\library\web\cms\launcher
|
||||
%SAFE_RMDIR% %TMP_UNSTABLE_DIR%\library\web\cms\library
|
||||
%SAFE_RMDIR% %TMP_UNSTABLE_DIR%\library\web\cms\src
|
||||
%SAFE_RMDIR% %TMP_UNSTABLE_DIR%\library\web\cms\doc
|
||||
%SAFE_RMDIR% %TMP_UNSTABLE_DIR%\library\web\cms\modules
|
||||
%SAFE_RMDIR% %TMP_UNSTABLE_DIR%\library\web\cms\examples
|
||||
|
||||
%COPYCMD% %TMP_DIR%\launcher %TMP_UNSTABLE_DIR%\library\web\cms\launcher
|
||||
%COPYCMD% %TMP_DIR%\library %TMP_UNSTABLE_DIR%\library\web\cms\library
|
||||
|
||||
Reference in New Issue
Block a user