Changeset 5


Ignore:
Timestamp:
05/13/08 10:01:29 (2 years ago)
Author:
AlexeyRusakov
Message:

Pushing the latest changes from Sitecore UA repository:

  • Scheduled command to update RSS feeds in database
  • Ability to use $(dataFolder) macro when defining disk location for xml feed
  • fixed bug with dates not being converted to UTC, which is required for ToString?("r") to work properly
  • Added 'Date Field' field - possibility to specify which field should be used to get the publication date of the item
  • Updated package project to use dynamic item sources
  • Changed package project and package names to be version agnostic
Location:
trunk
Files:
5 added
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/AssemblyInfo.cs

    r4 r5  
    55// associated with an assembly. 
    66// 
    7 [assembly: AssemblyVersion("1.2.1.0")] 
     7[assembly: AssemblyVersion("1.2.2.0")] 
    88[assembly: AssemblyDescription("RSS Module generates RSS feeds from Sitecore content items")] 
    99[assembly: AssemblyTitle("Sitecore RSS Module")] 
  • trunk/ChannelItem.cs

    r4 r5  
     1#region license 
     2 
    13/* *********************************************************************** * 
    24 * File   : ChannelItem.cs                                Part of Sitecore * 
     
    911 * Status : Published.                                                     * 
    1012 *                                                                         * 
    11  * Copyright (C) 1999-2004 by Sitecore A/S. All rights reserved.           * 
     13 * Copyright (C) 1999-2007 by Sitecore A/S. All rights reserved.           * 
    1214 *                                                                         * 
    1315 * This work is the property of:                                           * 
     
    2224 *                                                                         * 
    2325 * *********************************************************************** */ 
     26 
     27#endregion 
     28 
    2429#region using 
    2530 
    2631using System; 
    27 using System.Web; 
     32using System.Diagnostics; 
    2833using System.Xml; 
    2934using Sitecore.Data.Items; 
     
    3540#endregion using 
    3641 
    37  
    3842namespace Sitecore.Modules.RSS 
    3943{ 
     
    4145   /// Single item in rss feed (channel) 
    4246   /// </summary> 
     47   [DebuggerDisplay("{Title}, {PublishDate}")] 
    4348   public class ChannelItem 
    4449   { 
     
    7883         { 
    7984            DateTime date; 
    80  
    81             if (feed.FeedItem.IncludeUpdates) 
     85            if (!string.IsNullOrEmpty(feed.FeedItem.DateField)) 
     86            { 
     87               date = DateUtil.IsoDateToDateTime(item[feed.FeedItem.DateField]); 
     88            } 
     89            else if (feed.FeedItem.IncludeUpdates) 
    8290            { 
    8391               date = item.Statistics.Updated; 
     
    200208         packet.AddElement("description", Description); 
    201209         packet.AddElement("link", TextUtils.SafeUrl(Link)); 
    202          packet.AddElement("pubDate", PublishDate.ToString("r")); 
     210         packet.AddElement("pubDate", PublishDate.ToUniversalTime().ToString("r")); 
    203211 
    204212         if (feed.FeedItem.WriteAuthor) 
  • trunk/ChannelItemPublishDateComparer.cs

    r4 r5  
     1#region license 
     2 
    13/* *********************************************************************** * 
    24 * File   : ChannelItemPublishDateComparer.cs             Part of Sitecore * 
     
    911 * Status : Published.                                                     * 
    1012 *                                                                         * 
    11  * Copyright (C) 1999-2004 by Sitecore A/S. All rights reserved.           * 
     13 * Copyright (C) 1999-2007 by Sitecore A/S. All rights reserved.           * 
    1214 *                                                                         * 
    1315 * This work is the property of:                                           * 
     
    2224 *                                                                         * 
    2325 * *********************************************************************** */ 
     26 
     27#endregion 
    2428 
    2529using System; 
  • trunk/Constants.cs

    r4 r5  
     1#region license 
     2 
    13/* *********************************************************************** * 
    24 * File   : Constants.cs                                  Part of Sitecore * 
     
    911 * Status : Published.                                                     * 
    1012 *                                                                         * 
    11  * Copyright (C) 1999-2004 by Sitecore A/S. All rights reserved.           * 
     13 * Copyright (C) 1999-2007 by Sitecore A/S. All rights reserved.           * 
    1214 *                                                                         * 
    1315 * This work is the property of:                                           * 
     
    2325 * *********************************************************************** */ 
    2426 
     27#endregion 
     28 
    2529using Sitecore.Data; 
    2630 
    2731namespace Sitecore.Modules.RSS 
    2832{ 
    29         /// <summary> 
    30         /// Module-wide constants 
    31         /// </summary> 
    32         public class Constants 
    33         { 
     33   /// <summary> 
     34   /// Module-wide constants 
     35   /// </summary> 
     36   public class Constants 
     37   { 
    3438      /// <summary> 
    3539      /// Name of the RSS device 
     
    5660      /// </summary> 
    5761      public static ID FeedTemplateID = ID.Parse("{79B49430-39B1-47B0-84E1-8FB067CEF307}"); 
    58         } 
     62   } 
    5963} 
  • trunk/Controller.cs

    r4 r5  
     1#region license 
     2 
    13/* *********************************************************************** * 
    24 * File   : Controller.cs                                 Part of Sitecore * 
     
    911 * Status : Published.                                                     * 
    1012 *                                                                         * 
    11  * Copyright (C) 1999-2004 by Sitecore A/S. All rights reserved.           * 
     13 * Copyright (C) 1999-2007 by Sitecore A/S. All rights reserved.           * 
    1214 *                                                                         * 
    1315 * This work is the property of:                                           * 
     
    2224 *                                                                         * 
    2325 * *********************************************************************** */ 
     26 
     27#endregion 
    2428 
    2529#region using 
     
    4448   { 
    4549      /// <summary> 
    46       /// Refreshes all feeds found in the database 
     50      /// Refreshes all feeds found in the database in the specified language 
    4751      /// </summary> 
    4852      /// <param name="database">Database to refresh feeds in</param> 
     
    5054      public static void RefreshXmlFeeds(Database database, Language language) 
    5155      { 
     56         Error.AssertNotNull(database, "database"); 
     57         Error.AssertLanguage(language, "language", false); 
     58 
    5259         Item[] feeds = GetFeedsInDatabase(database, language); 
    5360 
     
    5663            // Add nice message log message. Providing the version helps a lot in support, as the 
    5764            // users often don't know what version they're actually using. 
    58             Log.Info("Sitecore RSS Module: refreshing feeds in the database. "  
    59                + Assembly.GetExecutingAssembly().FullName, typeof(Controller)); 
     65            Log.Info(string.Format("Sitecore RSS Module: refreshing feeds in {0} database, {1} language. Version: {2}",  
     66               database, language, Assembly.GetExecutingAssembly().FullName), typeof(Controller)); 
    6067 
    6168            foreach(Item feed in feeds) 
     
    6370               ((FeedItem)feed).RefreshStaticFeed(); 
    6471            } 
     72         } 
     73      } 
     74 
     75      /// <summary> 
     76      /// Refreshes all feeds found in the database in all languages 
     77      /// </summary> 
     78      /// <param name="database">Database to refresh feeds in</param> 
     79      public static void RefreshXmlFeeds(Database database) 
     80      { 
     81         Error.AssertNotNull(database, "database"); 
     82 
     83         foreach (Language language in database.Languages) 
     84         { 
     85            RefreshXmlFeeds(database, language); 
    6586         } 
    6687      } 
  • trunk/EmbeddedFeed.cs

    r4 r5  
     1#region license 
     2 
    13/* *********************************************************************** * 
    24 * File   : EmbeddedFeed.cs                               Part of Sitecore * 
     
    911 * Status : Published.                                                     * 
    1012 *                                                                         * 
    11  * Copyright (C) 1999-2004 by Sitecore A/S. All rights reserved.           * 
     13 * Copyright (C) 1999-2007 by Sitecore A/S. All rights reserved.           * 
    1214 *                                                                         * 
    1315 * This work is the property of:                                           * 
     
    2224 *                                                                         * 
    2325 * *********************************************************************** */ 
     26 
     27#endregion 
    2428 
    2529using Sitecore.Data.Items; 
  • trunk/Feed.cs

    r4 r5  
     1#region license 
     2 
    13/* *********************************************************************** * 
    24 * File   : Feed.cs                                       Part of Sitecore * 
     
    911 * Status : Published.                                                     * 
    1012 *                                                                         * 
    11  * Copyright (C) 1999-2004 by Sitecore A/S. All rights reserved.           * 
     13 * Copyright (C) 1999-2007 by Sitecore A/S. All rights reserved.           * 
    1214 *                                                                         * 
    1315 * This work is the property of:                                           * 
     
    2224 *                                                                         * 
    2325 * *********************************************************************** */ 
     26 
     27#endregion 
    2428 
    2529#region using 
     
    279283         packet.AddElement("description", feedItem.Description); 
    280284         packet.AddElement("link", TextUtils.SafeUrl(Link)); 
    281          packet.AddElement("pubDate", DateTime.Now.ToString("r")); 
    282          packet.AddElement("lastBuildDate", GetLastBuildDate().ToString("r")); 
     285         packet.AddElement("pubDate", DateTime.Now.ToUniversalTime().ToString("r")); 
     286         packet.AddElement("lastBuildDate", GetLastBuildDate().ToUniversalTime().ToString("r")); 
    283287         packet.AddElement("language", feedItem.InnerItem.Language.Name); 
    284288          
  • trunk/GlobalSettings.cs

    r4 r5  
     1#region license 
     2 
    13/* *********************************************************************** * 
    24 * File   : GlobalSettings.cs                             Part of Sitecore * 
     
    911 * Status : Published.                                                     * 
    1012 *                                                                         * 
    11  * Copyright (C) 1999-2004 by Sitecore A/S. All rights reserved.           * 
     13 * Copyright (C) 1999-2007 by Sitecore A/S. All rights reserved.           * 
    1214 *                                                                         * 
    1315 * This work is the property of:                                           * 
     
    2224 *                                                                         * 
    2325 * *********************************************************************** */ 
     26 
     27#endregion 
    2428 
    2529using Sitecore.Data; 
  • trunk/HttpRequest.cs

    r4 r5  
     1#region license 
     2 
    13/* *********************************************************************** * 
    24 * File   : HttpRequest.cs                                Part of Sitecore * 
     
    911 * Status : Published.                                                     * 
    1012 *                                                                         * 
    11  * Copyright (C) 1999-2004 by Sitecore A/S. All rights reserved.           * 
     13 * Copyright (C) 1999-2007 by Sitecore A/S. All rights reserved.           * 
    1214 *                                                                         * 
    1315 * This work is the property of:                                           * 
     
    2224 *                                                                         * 
    2325 * *********************************************************************** */ 
     26 
     27#endregion 
    2428 
    2529using Sitecore.Data.Items; 
  • trunk/ItemMiner.cs

    r4 r5  
     1#region license 
     2 
    13/* *********************************************************************** * 
    24 * File   : ItemMiner.cs                                  Part of Sitecore * 
     
    911 * Status : Published.                                                     * 
    1012 *                                                                         * 
    11  * Copyright (C) 1999-2004 by Sitecore A/S. All rights reserved.           * 
     13 * Copyright (C) 1999-2007 by Sitecore A/S. All rights reserved.           * 
    1214 *                                                                         * 
    1315 * This work is the property of:                                           * 
     
    2224 *                                                                         * 
    2325 * *********************************************************************** */ 
     26 
     27#endregion 
    2428 
    2529#region using 
     
    8387            string attribute; 
    8488 
    85             if (feedItem.IncludeUpdates) 
     89            if (!string.IsNullOrEmpty(feedItem.DateField)) 
     90            { 
     91               attribute = "#" + feedItem.DateField + "#"; 
     92            } 
     93            else if (feedItem.IncludeUpdates) 
    8694            { 
    8795               attribute = "__updated"; 
     
    92100            } 
    93101 
    94             predicate = string.Format("@{0} > '{1}'", attribute, notOlderThan, includeField); 
     102            predicate = string.Format("@{0} > '{1}'", attribute, notOlderThan); 
    95103         } 
    96104          
  • trunk/Items/FeedItem.cs

    r4 r5  
     1#region license 
     2 
    13/* *********************************************************************** * 
    24 * File   : FeedItem.cs                                   Part of Sitecore * 
     
    911 * Status : Published.                                                     * 
    1012 *                                                                         * 
    11  * Copyright (C) 1999-2004 by Sitecore A/S. All rights reserved.           * 
     13 * Copyright (C) 1999-2007 by Sitecore A/S. All rights reserved.           * 
    1214 *                                                                         * 
    1315 * This work is the property of:                                           * 
     
    2325 * *********************************************************************** */ 
    2426 
     27#endregion 
    2528 
    2629#region using 
    2730 
    2831using System; 
    29 using Sitecore.Data; 
     32using Sitecore.Configuration; 
    3033using Sitecore.Data.Items; 
    3134using Sitecore.IO; 
     
    9699            if (result.Length > 0) 
    97100            { 
     101               result = result.Replace("$(dataFolder)", Settings.DataFolder); 
    98102               return FileUtil.MapPath(result); 
    99103            } 
     
    281285 
    282286      /// <summary> 
     287      /// Provides the field that will be used to retrieve the publication date for each item of the feed 
     288      /// </summary> 
     289      public string DateField 
     290      { 
     291         get 
     292         { 
     293            return StringUtil.GetString(this[FeedItemFields.DateField], ""); 
     294         } 
     295      } 
     296 
     297      /// <summary> 
    283298      /// Provides the field that will be used to retrieve the link for each item of the feed. 
    284299      /// </summary> 
  • trunk/Items/FeedItemFieldNames.cs

    r4 r5  
     1#region license 
     2 
    13/* *********************************************************************** * 
    24 * File   : FeedItemFieldNames.cs                         Part of Sitecore * 
     
    911 * Status : Published.                                                     * 
    1012 *                                                                         * 
    11  * Copyright (C) 1999-2004 by Sitecore A/S. All rights reserved.           * 
     13 * Copyright (C) 1999-2007 by Sitecore A/S. All rights reserved.           * 
    1214 *                                                                         * 
    1315 * This work is the property of:                                           * 
     
    2325 * *********************************************************************** */ 
    2426 
     27#endregion 
    2528 
    2629namespace Sitecore.Modules.RSS.Items 
     
    4144      public const string TitleField = "Title Field"; 
    4245      public const string DescriptionField = "Description Field"; 
     46      public const string DateField = "Date Field"; 
    4347      public const string LinkField = "Link Field"; 
    4448      public const string IncludeInFeedField = "Include In Feed Field"; 
  • trunk/PublishingHandler.cs

    r4 r5  
     1#region license 
     2 
    13/* *********************************************************************** * 
    24 * File   : PublishingHandler.cs                          Part of Sitecore * 
     
    911 * Status : Published.                                                     * 
    1012 *                                                                         * 
    11  * Copyright (C) 1999-2004 by Sitecore A/S. All rights reserved.           * 
     13 * Copyright (C) 1999-2007 by Sitecore A/S. All rights reserved.           * 
    1214 *                                                                         * 
    1315 * This work is the property of:                                           * 
     
    2224 *                                                                         * 
    2325 * *********************************************************************** */ 
     26 
     27#endregion 
    2428 
    2529#region using 
  • trunk/RssEmitterPage.cs

    r4 r5  
     1#region license 
     2 
    13/* *********************************************************************** * 
    24 * File   : RssEmitterPage.cs                             Part of Sitecore * 
     
    911 * Status : Published.                                                     * 
    1012 *                                                                         * 
    11  * Copyright (C) 1999-2004 by Sitecore A/S. All rights reserved.           * 
     13 * Copyright (C) 1999-2007 by Sitecore A/S. All rights reserved.           * 
    1214 *                                                                         * 
    1315 * This work is the property of:                                           * 
     
    2224 *                                                                         * 
    2325 * *********************************************************************** */ 
     26 
     27#endregion 
    2428 
    2529using System; 
  • trunk/Sitecore.Modules.RSS.csproj

    r4 r5  
    148148      <SubType>Code</SubType> 
    149149    </Compile> 
     150    <Compile Include="UpdateFeedsCommand.cs" /> 
    150151  </ItemGroup> 
    151152  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> 
  • trunk/StaticChannelItem.cs

    r4 r5  
     1#region license 
     2 
    13/* *********************************************************************** * 
    24 * File   : StaticChannelItem.cs                          Part of Sitecore * 
     
    911 * Status : Published.                                                     * 
    1012 *                                                                         * 
    11  * Copyright (C) 1999-2004 by Sitecore A/S. All rights reserved.           * 
     13 * Copyright (C) 1999-2007 by Sitecore A/S. All rights reserved.           * 
    1214 *                                                                         * 
    1315 * This work is the property of:                                           * 
     
    2224 *                                                                         * 
    2325 * *********************************************************************** */ 
     26 
     27#endregion 
    2428 
    2529using System; 
  • trunk/StaticFeed.cs

    r4 r5  
     1#region license 
     2 
    13/* *********************************************************************** * 
    24 * File   : StaticFeed.cs                                 Part of Sitecore * 
     
    911 * Status : Published.                                                     * 
    1012 *                                                                         * 
    11  * Copyright (C) 1999-2004 by Sitecore A/S. All rights reserved.           * 
     13 * Copyright (C) 1999-2007 by Sitecore A/S. All rights reserved.           * 
    1214 *                                                                         * 
    1315 * This work is the property of:                                           * 
     
    2224 *                                                                         * 
    2325 * *********************************************************************** */ 
     26 
     27#endregion 
    2428 
    2529using Sitecore.Data.Items; 
  • trunk/TextUtils.cs

    r4 r5  
     1#region license 
     2 
    13/* *********************************************************************** * 
    24 * File   : TextUtils.cs                                  Part of Sitecore * 
     
    911 * Status : Published.                                                     * 
    1012 *                                                                         * 
    11  * Copyright (C) 1999-2004 by Sitecore A/S. All rights reserved.           * 
     13 * Copyright (C) 1999-2007 by Sitecore A/S. All rights reserved.           * 
    1214 *                                                                         * 
    1315 * This work is the property of:                                           * 
     
    2325 * *********************************************************************** */ 
    2426 
    25 using System; 
     27#endregion 
    2628 
    2729namespace Sitecore.Modules.RSS 
     
    3234   public class TextUtils 
    3335   { 
    34        
    35       #region static utilities 
    36  
    3736      /// <summary> 
    3837      /// Return safe URL 
     
    4948         return result; 
    5049      } 
    51  
    52       #endregion static utilities 
    53  
    54  
    5550   } 
    5651} 
Note: See TracChangeset for help on using the changeset viewer.