Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsNews FeedsNews FeedsBug in FeedBrowser (aka Feed Explorer)Bug in FeedBrowser (aka Feed Explorer)
Previous
 
Next
New Post
7/22/2008 4:16 PM
 

Hello all,

The Feed Explorer is not correctly displaying HTML images. For example, the Yahoo Top Stories RSS feed contains images, but these aren't showing in the rendered HTML. The problem has to do with this code segment in lines 449 thru 455 of the /Resources/FeedBrowser/scripts/feedbrowser.js file:

// First pass -- replace data tokens surrounded by [[ ]]
for(var attribute in itemData)
{
var dataValue = (allowHtml ? itemData[attribute].xmlEntityReplace() : itemData[attribute]);
// Replace the token with the actual data value
formattedItem = formattedItem.replaceAll("[[" + attribute + "]]", dataValue.replaceAll("'","'").replaceAll("\"",""").replaceAll(",",",").replaceAll("\n"," "));
}

Can anyone explain why apostrophes and double quotes are being escaped that way? My workaround is to simply pass the  "dataValue" variable as is, that is, as shown below:

// First pass -- replace data tokens surrounded by [[ ]]
for(var attribute in itemData)
{
var dataValue = (allowHtml ? itemData[attribute].xmlEntityReplace() : itemData[attribute]);
// Replace the token with the actual data value
formattedItem = formattedItem.replaceAll("[[" + attribute + "]]", dataValue ); // commented out -> .replaceAll("'","'").replaceAll("\"",""").replaceAll(",",",").replaceAll("\n"," ")
}

Doing this has no side-effects that I know of. Thanks in advance.

 
New Post
7/23/2008 9:23 AM
 

Well, it looks like I answered my own question.

The change that I made yesterday did in fact introduce a side-effect. The problem is with
this segment of code in line 457:

// And lastly -- if the template begins with @@, treat it as a function
if (formattedItem.substr(0,2) == "@@")
formattedItem = eval(formattedItem.substr(2));

Now I understand why apostrophes, quotation marks, etc. were being escaped. My changes
from yesterday caused the eval function to fail and thus throw a JavaScript syntax error. This
made the DNN Solution Explorer to stop functioning.

Below are the changes that I made to the RssInfo class in the file
/Resources/FeedBrowser/scripts/feedbrowser.js. The Rss
Info class begins at line 422
(including comments):

////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// BEGIN: RssInfo class                                                                                       //
// Defines the structure for a single RSS feed                                                                //
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
DotNetNuke.UI.WebControls.FeedBrowser.RssInfo = function(feed, template, header, allowHtml)
{
    this.formattedItems = [];
    var itemCollection = feed.value["items"];
    var feedHeader = [];

    if (header)
        feedHeader[0] = header;
       
    for(var item in itemCollection)
    {  
        var itemData = [];
        if (typeof(itemCollection[item]) == "object")
        {
            var ivalues = DotNetNuke.UI.WebControls.Utility.recurseElement("", itemCollection[item]);
            for(var iv in ivalues)
                itemData[iv] = ivalues[iv];
        }
        else
            itemData[item] = itemCollection[item];
           
        var formattedItem = template;
       
        // If the template is a function (i.e. begins with "@@") then treat it differently
        // as we would a normal HTML template
        if( formattedItem.substr(0,2) == "@@" )
        {
            // First pass -- replace data tokens surrounded by [[ ]]
            for(var attribute in itemData)
            {
                var dataValue = (allowHtml ? itemData[attribute].xmlEntityReplace() : itemData[attribute]);
                // Replace the token with the actual data value
                formattedItem = formattedItem
                    .replaceAll("[[" + attribute + "]]", dataValue
                    .replaceAll("'","'")
                    .replaceAll("\"",""")
                    .replaceAll(",",",")
                    .replaceAll("\n"," "));
            }           

            // And lastly -- since template begins with @@, we treat it as a function       
            formattedItem = eval(formattedItem.substr(2));
        }
        else // Normal template
        {
            // First pass -- replace data tokens surrounded by [[ ]]
            for(var attribute in itemData)
            {
                var dataValue = (allowHtml ? itemData[attribute].xmlEntityReplace() : itemData[attribute]);
                // Replace the token with the actual data value. Do not do any special processing
                formattedItem = formattedItem.replaceAll("[[" + attribute + "]]", dataValue);
            }
        }

        this.formattedItems[this.formattedItems.length] = formattedItem;
    }
   
    this.formattedItems = feedHeader.concat(this.formattedItems.sort());   
}
DotNetNuke.UI.WebControls.FeedBrowser.RssInfo.registerClass("DotNetNuke.UI.WebControls.FeedBrowser.RssInfo");
// END: RssInfo class
 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsNews FeedsNews FeedsBug in FeedBrowser (aka Feed Explorer)Bug in FeedBrowser (aka Feed Explorer)


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out