Author: hoang_to
Date: 2010-08-16 00:08:47 -0400 (Mon, 16 Aug 2010)
New Revision: 3832
Modified:
portal/trunk/gadgets/eXoGadgets/src/main/webapp/gadgets/rssAggregator/script.js
Log:
GTNPORTAL-1413: Apply patch of the issue to trunk
Modified: portal/trunk/gadgets/eXoGadgets/src/main/webapp/gadgets/rssAggregator/script.js
===================================================================
---
portal/trunk/gadgets/eXoGadgets/src/main/webapp/gadgets/rssAggregator/script.js 2010-08-16
03:58:50 UTC (rev 3831)
+++
portal/trunk/gadgets/eXoGadgets/src/main/webapp/gadgets/rssAggregator/script.js 2010-08-16
04:08:47 UTC (rev 3832)
@@ -83,16 +83,20 @@
}
}
-RssAggregator.prototype.renderFeed = function(feed) {
- this.feed = feed;
- gadgets.window.setTitle("RSS: " + feed.Title);
+RssAggregator.prototype.renderFeed = function(feedObj) {
+ if(feedObj.rc != 200 && feedObj.data == undefined) {
+ document.write("the url: " + feedurl + " is down or invalid");
+ return;
+ }
+ this.feed = feedObj.data;
+ gadgets.window.setTitle("RSS: " + this.feed.Title);
var feedEl = _gel("feedContainer");
var bullet = "<img src='" + this.getFavicon(feedurl) + "'
alt='' border=0 align='absmiddle' style='height:16;width:16;'
onerror='this.style.visibility=\"hidden\";'> ";
- if (feed != null) {
+ if (this.feed != null) {
// Access the data for a given entry
- if (feed.Entry) {
- for (var i = 0; i < feed.Entry.length; i++) {
+ if (this.feed.Entry) {
+ for (var i = 0; i < this.feed.Entry.length; i++) {
var itemEl = document.createElement('div');
var item_title = document.createElement('div');
var item_more = document.createElement('div');
@@ -116,10 +120,10 @@
item_date.className = 'date';
item_link.className = 'link';
- item_title.innerHTML = bullet + "<a
id='link_title_"+i+"' class='titlelink' href='" +
feed.Entry[i].Link + "'
onclick='rssAggregator.toggleDescription("+i+");return false;'>"
+ feed.Entry[i].Title + "</a>";
- item_date.innerHTML = this.timeToPrettyString(feed.Entry[i].Date);
+ item_title.innerHTML = bullet + "<a
id='link_title_"+i+"' class='titlelink' href='" +
this.feed.Entry[i].Link + "'
onclick='rssAggregator.toggleDescription("+i+");return false;'>"
+ this.feed.Entry[i].Title + "</a>";
+ item_date.innerHTML = this.timeToPrettyString(this.feed.Entry[i].Date);
- item_desc.innerHTML = feed.Entry[i].Summary;
+ item_desc.innerHTML = this.feed.Entry[i].Summary;
item_link.innerHTML = this.generateLinkContent(i);
@@ -146,6 +150,10 @@
}
RssAggregator.prototype.refreshFeed = function() {
- _IG_FetchFeedAsJSON(prefs.getString("rssurl"), function(feed)
{rssAggregator.renderFeed(feed);}, entries, true);
+ var params = {};
+ params[gadgets.io.RequestParameters.CONTENT_TYPE] = gadgets.io.ContentType.FEED;
+ params[gadgets.io.RequestParameters.NUM_ENTRIES] = entries;
+ params[gadgets.io.RequestParameters.GET_SUMMARIES] = true;
+ gadgets.io.makeRequest(prefs.getString("rssurl"), function(feedObj)
{rssAggregator.renderFeed(feedObj);}, params);
}
Show replies by date