Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
intranet-rss-reader
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
project-open
intranet-rss-reader
Commits
65207031
Commit
65207031
authored
Aug 07, 2008
by
Frank Bergmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial Import
parents
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
354 additions
and
0 deletions
+354
-0
intranet-rss-reader.info
intranet-rss-reader.info
+27
-0
intranet-rss-reader-procs.tcl
tcl/intranet-rss-reader-procs.tcl
+158
-0
index.tcl
www/index.tcl
+169
-0
No files found.
intranet-rss-reader.info
0 → 100644
View file @
65207031
<?xml version="1.0"?>
<!-- Generated by the OpenACS Package Manager -->
<package
key=
"intranet-rss-reader"
url=
"http://openacs.org/repository/apm/packages/intranet-rss-reader"
type=
"apm_application"
>
<package-name>
]project-open[ RSS Reader
</package-name>
<pretty-plural>
]project-open[ RSS Reader
</pretty-plural>
<initial-install-p>
f
</initial-install-p>
<singleton-p>
t
</singleton-p>
<auto-mount>
intranet-rss-reader
</auto-mount>
<version
name=
"3.4.0.2"
url=
"http://openacs.org/repository/download/apm/intranet-rss-reader-3.4.0.2.apm"
>
<owner
url=
"mailto:frank.bergmann@project-open.com"
>
Frank Bergmann
</owner>
<summary>
Displays the contents of a number of rss feeds as an HTML page
</summary>
<vendor
url=
"http://www.project-open.com/"
>
]project-open[
</vendor>
<description
format=
"text/plain"
>
Displays the contents of a number of rss feeds as an HTML page
</description>
<maturity>
0
</maturity>
<provides
url=
"intranet-rss-reader"
version=
"3.4.0.2"
/>
<callbacks>
</callbacks>
<parameters>
<!-- No version parameters -->
</parameters>
</version>
</package>
tcl/intranet-rss-reader-procs.tcl
0 → 100644
View file @
65207031
# /packages/intranet-rss-reader/tcl/intranet-rss-reader-procs.tcl
#
# Copyright (C
)
2008
]
project-open
[
#
# All rights reserved. Please check
# http://www.project-open.com/license/ for details.
ad_library
{
Auxiallary functions to read RSS feeds
@author frank.bergmann@project-open.com
}
# ----------------------------------------------------------------------
#
# ----------------------------------------------------------------------
#
set
feed_ctr 0
set
debug
""
set
html
""
foreach
rss_feed
$rss
_feeds
{
if
{
[
catch
{
set update_xml
[
ns_httpget
$rss
_feed
]
}
errmsg
]
}
{
ad_return_complaint 1
"Error while accessing the URL '
$rss
_feed'.<br>
Please check your URL. The following error was returned: <br>
<blockquote><pre>
[
ad_quotehtml
$errmsg
]
</pre></blockquote>"
return
}
if
{
""
==
$update
_xml
}
{
ad_return_complaint 1
"Found an empty XML file accessing the URL '
$rss
_feed'.<br>
This means that your server(!) was not able to access the URL.<br>
Please check the the Internet and firewall configuration of your
server and verify that the 'nsd' (Linux) or 'nsd4' (Windows)
process has access to the URL.<br>"
return
}
# ------------------------------------------------------------
# Check whether it's a HTML or an XML
#
if
{
!
[
regexp
{
<
([
^>
]
*
)
>
\s
*<
([
^>
]
*
)
>
\s
*<
([
^>
]
*
)
>
}
$update
_xml match tag1 tag2 tag3
]}
{
ad_return_complaint 1
"Error while retreiving update information from
URL '
$rss
_feed'.<br>The retreived files doesn't seem to be a XML or HTML file:<br>
<pre>
$update
_xml</pre>"
return
}
if
{[
string
tolower
$tag1
]
==
"html"
||
[
string
tolower
$tag2
]
==
"html"
||
[
string
tolower
$tag3
]
==
"html"
}
{
ad_return_complaint 1
"Error while retreiving update information from URL<br>
'
$rss
_feed'.<br>
The retreived result seems to be a HTML document and not an XML document.<br>
Please check the URL above and/or send an error report to
<a href=
\"
mailto:support@project-open.com
\"
>support@project-open.com</a>.
<br> </br>
Here is what the server returned:
<br> </br>
<pre>
$update
_xml</pre>"
}
ns_log notice
"rss-reader: match=
$match
, tag1=
$tag1
, tag2=
$tag2
, tag3=
$tag3
"
# ------------------------------------------------------------
# Parse the XML file and generate the HTML table
#
# Sample File:
#
# <?xml version="1.0" encoding="UTF-8"?>
# <rss version="2.0">
# <channel>
# <title>
]project-open
[
</title>
# <link>http://www.project-open.com</link>
# <description>News from the maintainers of
]
project-open
[
</description>
# <language>en-us</language>
# <copyright>Copyright 2008
]
project-open
[
</copyright>
# <pubDate>Mon, 03 Mar 2008 11:39:00 GMT</pubDate>
# <lastBuildDate>Tue, 22 Jul 2008 16:30:27 GMT</lastBuildDate>
#
# <item>
# <title>Updated Italien Localization available for download</title>
# <link>http://www.project-open.org/sources/italian_catalogs_update.rar</link>
# <description>Thanks goes to our partner ...</description>
# <guid isPermaLink="false">{ca01b700-eaba-981c-d97b-7280a9cbd186
}
</guid>
# <pubDate>Tue, 22 Jul 2008 16:30:27 GMT</pubDate>
# </item>
# <item>
# <title>Get a sneak preview of
]
po
[
V3.4</title>
# <link>http://po34demo.dnsalias.com</link>
# <description>New navigation elements ...</description>
# <guid isPermaLink="false">{2b5d3671-6aa5-6089-4b70-ca11648f2dcf
}
</guid>
# <pubDate>Thu, 26 Jun 2008 09:55:42 GMT</pubDate>
# </item>
# </channel>
# </rss>
set
tree
[
xml_parse -persist
$update
_xml
]
set
rss_node
[
xml_doc_get_first_node
$tree
]
set
root_name
[
xml_node_get_name
$rss
_node
]
if
{
!
[
string
equal
$root
_name
"rss"
]
}
{
ad_return_complaint 1
"Expected 'rss' as root node of update.xml file, found: '
$root
_name'"
}
set
channel_nodes
[
xml_node_get_children
$rss
_node
]
set
channel_ctr 0
foreach
channel_node
$channel
_nodes
{
if
{[
catch
{
set
channel_title
[[
$channel
_node selectNodes
{
title
}]
text
]}
err_msg
]}
{
set channel_title
"unknown title"
}
if
{[
catch
{
set
channel_link
[[
$channel
_node selectNodes
{
link
}]
text
]}
err_msg
]}
{
set channel_link
""
}
if
{[
catch
{
set
channel_description
[[
$channel
_node selectNodes
{
description
}]
text
]}
err_msg
]}
{
set channel_description
""
}
if
{[
catch
{
set
channel_language
[[
$channel
_node selectNodes
{
language
}]
text
]}
err_msg
]}
{
set channel_language
"en_US"
}
if
{[
catch
{
set
channel_copyright
[[
$channel
_node selectNodes
{
copyright
}]
text
]}
err_msg
]}
{
set channel_copyright
""
}
if
{[
catch
{
set
channel_pubDate
[[
$channel
_node selectNodes
{
pubDate
}]
text
]}
err_msg
]}
{
set channel_pubDate
""
}
if
{[
catch
{
set
channel_lastBuildDate
[[
$channel
_node selectNodes
{
lastBuildDate
}]
text
]}
err_msg
]}
{
set channel_lastBuildDate
""
}
append html
"<h1><a href='
$channel
_link'>
$channel
_title</a></h1>
\n
"
append html
"<p>
\n
$channel
_description
\n
</p>
\n
"
# Go through each item
# <item>
# <title>Get a sneak preview of ]po
[
V3.4</title>
# <link>http://po34demo.dnsalias.com</link>
# <description>New navigation elements ...</description>
# <guid isPermaLink=
"false"
>
{
2b5d3671-6aa5-6089-4b70-ca11648f2dcf
}
</guid>
# <pubDate>Thu, 26 Jun 2008 09:55:42 GMT</pubDate>
# </item>
set item_nodes
[
xml_node_get_children
$channel
_node
]
foreach item_node
$item
_nodes
{
if
{[
catch
{
set
item_title
[[
$item
_node selectNodes
{
title
}]
text
]}
err_msg
]}
{
set item_title
""
}
if
{[
catch
{
set
item_link
[[
$item
_node selectNodes
{
link
}]
text
]}
err_msg
]}
{
set item_link
""
}
if
{[
catch
{
set
item_description
[[
$item
_node selectNodes
{
description
}]
text
]}
err_msg
]}
{
set item_description
""
}
if
{[
catch
{
set
item_guid
[[
$item
_node selectNodes
{
guid
}]
text
]}
err_msg
]}
{
set item_guid
""
}
if
{[
catch
{
set
item_pubDate
[[
$item
_node selectNodes
{
pubDate
}]
text
]}
err_msg
]}
{
set item_pubDate
""
}
append html
"<h3><a href='
$item
_link'>
$item
_title</a></h3>
\n
"
append html
"<p>
\n
$item
_description
\n
</p>
\n
"
}
incr item_ctr
}
incr feed_ctr
}
ns_return 200
"text/html"
$html
www/index.tcl
0 → 100644
View file @
65207031
ad_page_contract
{
Loads several RSS feeds and displays them
@author Frank Bergmann <frank.bergmann@project-open.com>
@creation-date July 2008
@cvs-id $Id$
}
{
{
rss_feeds:multiple
""
}
}
if
{
""
==
$rss
_feeds
}
{
# lappend rss_feeds "http://globalwatchtower.com/feed/index.html"
lappend rss_feeds
"http://www.project-open.org/rss/project-open-community.rss"
lappend rss_feeds
"http://sourceforge.net/export/rss2_projnews.php?group_id=86419"
}
# ------------------------------------------------------------
# Authentication & defaults
#
set
user_id
[
auth::require_login
]
set
page_title
[
lang::message::lookup intranet-cust-project.RSS
"RSS"
]
# ------------------------------------------------------------
# Fetch the RSS feeds from the remote servers
#
set
feed_ctr 0
set
debug
""
set
html
""
set
item_ctr 0
foreach
rss_feed
$rss
_feeds
{
if
{
[
catch
{
set update_xml
[
ns_httpget
$rss
_feed
]
}
errmsg
]
}
{
ad_return_complaint 1
"Error while accessing the URL '
$rss
_feed'.<br>
Please check your URL. The following error was returned: <br>
<blockquote><pre>
[
ad_quotehtml
$errmsg
]
</pre></blockquote>"
return
}
if
{
""
==
$update
_xml
}
{
ad_return_complaint 1
"Found an empty XML file accessing the URL '
$rss
_feed'.<br>
This means that your server(!) was not able to access the URL.<br>
Please check the the Internet and firewall configuration of your
server and verify that the 'nsd' (Linux) or 'nsd4' (Windows)
process has access to the URL.<br>"
return
}
# ------------------------------------------------------------
# Check whether it's a HTML or an XML
#
if
{
!
[
regexp
{
<
([
^>
]
*
)
>
\s
*<
([
^>
]
*
)
>
\s
*<
([
^>
]
*
)
>
}
$update
_xml match tag1 tag2 tag3
]}
{
ad_return_complaint 1
"Error while retreiving update information from
URL '
$rss
_feed'.<br>The retreived files doesn't seem to be a XML or HTML file:<br>
<pre>
$update
_xml</pre>"
return
}
if
{[
string
tolower
$tag1
]
==
"html"
||
[
string
tolower
$tag2
]
==
"html"
||
[
string
tolower
$tag3
]
==
"html"
}
{
ad_return_complaint 1
"Error while retreiving update information from URL<br>
'
$rss
_feed'.<br>
The retreived result seems to be a HTML document and not an XML document.<br>
Please check the URL above and/or send an error report to
<a href=
\"
mailto:support@project-open.com
\"
>support@project-open.com</a>.
<br> </br>
Here is what the server returned:
<br> </br>
<pre>
$update
_xml</pre>"
}
ns_log notice
"rss-reader: match=
$match
, tag1=
$tag1
, tag2=
$tag2
, tag3=
$tag3
"
# ------------------------------------------------------------
# Parse the XML file and generate the HTML table
#
# Sample File:
#
# <?xml version="1.0" encoding="UTF-8"?>
# <rss version="2.0">
# <channel>
# <title>
]project-open
[
</title>
# <link>http://www.project-open.com</link>
# <description>News from the maintainers of
]
project-open
[
</description>
# <language>en-us</language>
# <copyright>Copyright 2008
]
project-open
[
</copyright>
# <pubDate>Mon, 03 Mar 2008 11:39:00 GMT</pubDate>
# <lastBuildDate>Tue, 22 Jul 2008 16:30:27 GMT</lastBuildDate>
#
# <item>
# <title>Updated Italien Localization available for download</title>
# <link>http://www.project-open.org/sources/italian_catalogs_update.rar</link>
# <description>Thanks goes to our partner ...</description>
# <guid isPermaLink="false">{ca01b700-eaba-981c-d97b-7280a9cbd186
}
</guid>
# <pubDate>Tue, 22 Jul 2008 16:30:27 GMT</pubDate>
# </item>
# <item>
# <title>Get a sneak preview of
]
po
[
V3.4</title>
# <link>http://po34demo.dnsalias.com</link>
# <description>New navigation elements ...</description>
# <guid isPermaLink="false">{2b5d3671-6aa5-6089-4b70-ca11648f2dcf
}
</guid>
# <pubDate>Thu, 26 Jun 2008 09:55:42 GMT</pubDate>
# </item>
# </channel>
# </rss>
set
tree
[
xml_parse -persist
$update
_xml
]
set
rss_node
[
xml_doc_get_first_node
$tree
]
set
root_name
[
xml_node_get_name
$rss
_node
]
if
{
!
[
string
equal
$root
_name
"rss"
]
}
{
ad_return_complaint 1
"Expected 'rss' as root node of update.xml file, found: '
$root
_name'"
}
set
channel_nodes
[
xml_node_get_children
$rss
_node
]
set
channel_ctr 0
foreach
channel_node
$channel
_nodes
{
if
{[
catch
{
set
channel_title
[[
$channel
_node selectNodes
{
title
}]
text
]}
err_msg
]}
{
set channel_title
"unknown title"
}
if
{[
catch
{
set
channel_link
[[
$channel
_node selectNodes
{
link
}]
text
]}
err_msg
]}
{
set channel_link
""
}
if
{[
catch
{
set
channel_description
[[
$channel
_node selectNodes
{
description
}]
text
]}
err_msg
]}
{
set channel_description
""
}
if
{[
catch
{
set
channel_language
[[
$channel
_node selectNodes
{
language
}]
text
]}
err_msg
]}
{
set channel_language
"en_US"
}
if
{[
catch
{
set
channel_copyright
[[
$channel
_node selectNodes
{
copyright
}]
text
]}
err_msg
]}
{
set channel_copyright
""
}
if
{[
catch
{
set
channel_pubDate
[[
$channel
_node selectNodes
{
pubDate
}]
text
]}
err_msg
]}
{
set channel_pubDate
""
}
if
{[
catch
{
set
channel_lastBuildDate
[[
$channel
_node selectNodes
{
lastBuildDate
}]
text
]}
err_msg
]}
{
set channel_lastBuildDate
""
}
append html
"<h1><a href='
$channel
_link'>
$channel
_title</a></h1>
\n
"
append html
"<p>
\n
$channel
_description
\n
</p>
\n
"
# Go through each item
# <item>
# <title>Get a sneak preview of ]po
[
V3.4</title>
# <link>http://po34demo.dnsalias.com</link>
# <description>New navigation elements ...</description>
# <guid isPermaLink=
"false"
>
{
2b5d3671-6aa5-6089-4b70-ca11648f2dcf
}
</guid>
# <pubDate>Thu, 26 Jun 2008 09:55:42 GMT</pubDate>
# </item>
set item_nodes
[
xml_node_get_children
$channel
_node
]
foreach item_node
$item
_nodes
{
if
{[
catch
{
set
item_title
[[
$item
_node selectNodes
{
title
}]
text
]}
err_msg
]}
{
set item_title
""
}
if
{[
catch
{
set
item_link
[[
$item
_node selectNodes
{
link
}]
text
]}
err_msg
]}
{
set item_link
""
}
if
{[
catch
{
set
item_description
[[
$item
_node selectNodes
{
description
}]
text
]}
err_msg
]}
{
set item_description
""
}
if
{[
catch
{
set
item_guid
[[
$item
_node selectNodes
{
guid
}]
text
]}
err_msg
]}
{
set item_guid
""
}
if
{[
catch
{
set
item_pubDate
[[
$item
_node selectNodes
{
pubDate
}]
text
]}
err_msg
]}
{
set item_pubDate
""
}
append html
"<h3><a href='
$item
_link'>
$item
_title</a></h3>
\n
"
append html
"<p>
\n
$item
_description
\n
</p>
\n
"
}
incr item_ctr
}
incr feed_ctr
}
ns_return 200
"text/html"
$html
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment