Login | Register
My pages Projects Community openCollabNet

Discussions > commits > svn commit: r11 - trunk/src: . ATOM.Net/Atom.NET/tests/invalidentries/cvs Controls HttpHandlers Images Utils

subview
Discussion topic

Back to topic list

svn commit: r11 - trunk/src: . ATOM.Net/Atom.NET/tests/invalidentries/cvs Controls HttpHandlers Images Utils

Reply

Author rayj
Full name Ray Johnson
Date 2006-08-15 16:59:34 PDT
Message Author: rayj
Date: 2006-08-15 16:59:34-0700
New Revision: 11

Added:
   trunk/src/Images/fee​d-icon-14x14.png (contents, props changed)
   trunk/src/Images/fee​d-icon-28x28.png (contents, props changed)
   trunk/src/Utils/FeedUtils.cs
Removed:
   trunk/src/ATOM.Net/A​tom.NET/tests/invali​dentries/cvs/
Modified:
   trunk/src/BrowseHandler.aspx.cs
   trunk/src/Controls/Footer.ascx
   trunk/src/Controls/F​ooter.ascx.cs
   trunk/src/Controls/F​ooter.ascx.designer.​cs
   trunk/src/HttpHandle​rs/BrowseHandler.cs
   trunk/src/Subview.csproj
   trunk/src/Subview.sln
   trunk/src/TASKS.txt

Log:
Added support for ATOM feeds for directories. However, it needs more
work - it will currently hang for directories with large logs (usually)
the interesting ones...


Modified: trunk/src/BrowseHandler.aspx.cs
Url: http://subview.tigri​s.org/source/browse/​subview/trunk/src/Br​owseHandler.aspx.cs?​view=diff&rev=11​&p1=trunk/src/Br​owseHandler.aspx.cs​&p2=trunk/src/Bro​wseHandler.aspx.cs​&r1=10&r2=11
====================​====================​====================​==================
--- trunk/src/BrowseHandler.aspx.cs (original)
+++ trunk/src/BrowseHandler.aspx.cs 2006-08-15 16:59:34-0700
@@ -3,11 +3,13 @@
 using System.Text.RegularExpressions;
 using System.Web.UI;
 using System.Web.UI.HtmlControls;
+using Atom.Core;
 using subview.Configuration;
 using subview.Controls;
 using Subview.Controls;
 using subview.Subversion;
 using subview.Utils;
+using Subview.Utils;
 
 namespace subview
 {
@@ -103,6 +105,20 @@
                 Response.End();
                 File.Delete(tmpFile);
             }
+ else if (View == "atom")
+ {
+ SvnLog log = Svn.Log(SvnPath);
+ AtomFeed atomFeed = FeedUtils.CreateFeed​FromLog(Request.Url.​GetLeftPart(UriParti​al.Path), log);
+
+ // Response.Clear();
+ // Response.ClearHeaders();
+ Response.ClearContent();
+
+ Response.ContentType = "text/xml";
+ atomFeed.Save(Respon​se.OutputStream);
+
+ Response.End();
+ }
             else
             {
                 if (! Request.Url.GetLeftP​art(UriPartial.Path)​.EndsWith("/"))

Modified: trunk/src/Controls/Footer.ascx
Url: http://subview.tigri​s.org/source/browse/​subview/trunk/src/Co​ntrols/Footer.ascx?v​iew=diff&rev=11​&p1=trunk/src/Con​trols/Footer.ascx​&p2=trunk/src/Contr​ols/Footer.ascx&​r1=10&r2=11
====================​====================​====================​==================
--- trunk/src/Controls/Footer.ascx (original)
+++ trunk/src/Controls/Footer.ascx 2006-08-15 16:59:34-0700
@@ -1,2 +1,7 @@
 <%@ Control Language="c#" AutoEventWireup="True" Codebehind="Footer.ascx.cs" Inherits="subview.Co​ntrols.Footer" TargetSchema="http://schemas.micro​soft.com/intellisens​e/ie5"%>
-Powered by <a href="http://subview.tigris.org">Subview</a>
\ No newline at end of file
+<table width="100%">
+<tr>
+<td>Powered by <a href="http://subview.tigris.org">Subview</a​></td>
+<td><a id="feedIcon" runat="server" href="/replaceme/"><img alt="Atom Feed for Directory" src="/Images/feed-ic​on-14x14.png" height="14" width="14"/></​a></td>
+</tr>
+</table>
\ No newline at end of file

Modified: trunk/src/Controls/F​ooter.ascx.cs
Url: http://subview.tigri​s.org/source/browse/​subview/trunk/src/Co​ntrols/Footer.ascx.c​s?view=diff&rev=​11&p1=trunk/src/​Controls/Footer.ascx​.cs&p2=trunk/src​/Controls/Footer.asc​x.cs&r1=10&r​2=11
====================​====================​====================​==================
--- trunk/src/Controls/F​ooter.ascx.cs (original)
+++ trunk/src/Controls/F​ooter.ascx.cs 2006-08-15 16:59:34-0700
@@ -1,5 +1,6 @@
 using System;
 using System.Web.UI;
+using System.Web.UI.WebControls;
 
 namespace subview.Controls
 {
@@ -11,7 +12,15 @@
 
         protected void Page_Load(object sender, EventArgs e)
         {
- // Put user code to initialize the page here
+ if (Request.Url.GetLeft​Part(UriPartial.Path​).EndsWith("/"))
+ {
+ feedIcon.HRef = Request.Url.GetLeftP​art(UriPartial.Path)​ + "?view=atom";
+ feedIcon.Visible = true;
+ }
+ else
+ {
+ feedIcon.Visible = false;
+ }
         }
 
         #region Web Form Designer generated code

Modified: trunk/src/Controls/F​ooter.ascx.designer.​cs
Url: http://subview.tigri​s.org/source/browse/​subview/trunk/src/Co​ntrols/Footer.ascx.d​esigner.cs?view=diff​&rev=11&p1=t​runk/src/Controls/Fo​oter.ascx.designer.c​s&p2=trunk/src/C​ontrols/Footer.ascx.​designer.cs&r1=1​0&r2=11
====================​====================​====================​==================
--- trunk/src/Controls/F​ooter.ascx.designer.​cs (original)
+++ trunk/src/Controls/F​ooter.ascx.designer.​cs 2006-08-15 16:59:34-0700
@@ -11,5 +11,6 @@
 namespace subview.Controls {
     
     public partial class Footer {
+ protected System.Web.UI.HtmlCo​ntrols.HtmlAnchor feedIcon;
     }
 }

Modified: trunk/src/HttpHandle​rs/BrowseHandler.cs
Url: http://subview.tigri​s.org/source/browse/​subview/trunk/src/Ht​tpHandlers/BrowseHan​dler.cs?view=diff​&rev=11&p1=trun​k/src/HttpHandlers/B​rowseHandler.cs&​p2=trunk/src/HttpHan​dlers/BrowseHandler.​cs&r1=10&r2=​11
====================​====================​====================​==================
--- trunk/src/HttpHandle​rs/BrowseHandler.cs (original)
+++ trunk/src/HttpHandle​rs/BrowseHandler.cs 2006-08-15 16:59:34-0700
@@ -56,21 +56,24 @@
                     context.Response.ContentType = "text/css";
                     context.Response.Wri​teFile(path);
                     return null;
- }
-
- if (url.ToLower().EndsW​ith(".gif"))
+ } else if (url.ToLower().EndsW​ith(".gif"))
                 {
                     context.Response.ContentType = "image/GIF";
                     context.Response.Wri​teFile(path);
                     return null;
                 }
-
- if (url.ToLower().EndsW​ith(".ico"))
+ else if (url.ToLower().EndsW​ith(".ico"))
                 {
                     context.Response.ContentType = "image/x-icon";
                     context.Response.Wri​teFile(path);
                     return null;
                 }
+ else if (url.ToLower().EndsW​ith(".png"))
+ {
+ context.Response.ContentType = "image/PNG";
+ context.Response.Wri​teFile(path);
+ return null;
+ }
             }
             
             return PageParser.GetCompil​edPageInstance(url, path, context);

Added: trunk/src/Images/fee​d-icon-14x14.png
Url: http://subview.tigri​s.org/source/browse/​subview/trunk/src/Im​ages/feed-icon-14x14​.png?view=auto&r​ev=11
====================​====================​====================​==================
Binary file. No diff available.

Added: trunk/src/Images/fee​d-icon-28x28.png
Url: http://subview.tigri​s.org/source/browse/​subview/trunk/src/Im​ages/feed-icon-28x28​.png?view=auto&r​ev=11
====================​====================​====================​==================
Binary file. No diff available.

Modified: trunk/src/Subview.csproj
Url: http://subview.tigri​s.org/source/browse/​subview/trunk/src/Su​bview.csproj?view=di​ff&rev=11&p1​=trunk/src/Subview.c​sproj&p2=trunk/s​rc/Subview.csproj​&r1=10&r2=11
====================​====================​====================​==================
--- trunk/src/Subview.csproj (original)
+++ trunk/src/Subview.csproj 2006-08-15 16:59:34-0700
@@ -65,6 +65,8 @@
     <Content Include="Images\checkmark.gif" />
     <Content Include="Images\dir.gif" />
     <Content Include="Images\Down.gif" />
+ <Content Include="Images\fee​d-icon-14x14.png" />
+ <Content Include="Images\fee​d-icon-28x28.png" />
     <Content Include="Images\loading.gif" />
     <Content Include="Images\text.gif" />
     <Content Include="Images\Up.gif" />
@@ -172,6 +174,7 @@
     <Compile Include="Utils\DiffToHTML.cs" />
     <Compile Include="Utils\Enscript.cs" />
     <Compile Include="Utils\FileType.cs" />
+ <Compile Include="Utils\AtomFeedUtil.cs" />
     <Compile Include="Utils\Skins.cs" />
   </ItemGroup>
   <ItemGroup>
@@ -213,6 +216,12 @@
     </EmbeddedResource>
   </ItemGroup>
   <ItemGroup>
+ <ProjectReference Include="ATOM.Net\A​tom.NET\Atom.NET.cs​proj">
+ <Project>{8DE2​053A-247B-430A-86C3-​E52B4725AA60}</Pr​oject>
+ <Name>Atom.NET​</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
     <Folder Include="Properties\" />
   </ItemGroup>
   <Import Project="$(MSBuildB​inPath)\Microsoft.C​Sharp.targets" />

Modified: trunk/src/Subview.sln
Url: http://subview.tigri​s.org/source/browse/​subview/trunk/src/Su​bview.sln?view=diff​&rev=11&p1=tr​unk/src/Subview.sln​&p2=trunk/src/Sub​view.sln&r1=10​&r2=11
====================​====================​====================​==================
--- trunk/src/Subview.sln (original)
+++ trunk/src/Subview.sln 2006-08-15 16:59:34-0700
@@ -3,6 +3,8 @@
 # Visual Studio 2005
 Project("{FAE04EC0-3​01F-11D3-BF4B-00C04F​79EFBC}") = "Subview", "Subview.csproj", "{B5879BF4-46EE-4A99​-9B80-8EB263AAD624}"​
 EndProject
+Project("{FAE04EC0-​301F-11D3-BF4B-00C04​F79EFBC}") = "Atom.NET", "ATOM.Net\Atom.NET​Atom.NET.csproj", "{8DE2053A-247B-430A​-86C3-E52B4725AA60}"​
+EndProject
 Global
     GlobalSection(Soluti​onConfigurationPlatf​orms) = preSolution
         Debug|Any CPU = Debug|Any CPU
@@ -13,6 +15,10 @@
         {B5879BF4-46EE-4A99-​9B80-8EB263AAD624}.D​ebug|Any CPU.Build.0 = Debug|Any CPU
         {B5879BF4-46EE-4A99-​9B80-8EB263AAD624}.R​elease|Any CPU.ActiveCfg = Release|Any CPU
         {B5879BF4-46EE-4A99-​9B80-8EB263AAD624}.R​elease|Any CPU.Build.0 = Release|Any CPU
+ {8DE2053A-247B-430A-​86C3-E52B4725AA60}.D​ebug|Any CPU.ActiveCfg = Debug|Any CPU
+ {8DE2053A-247B-430A-​86C3-E52B4725AA60}.D​ebug|Any CPU.Build.0 = Debug|Any CPU
+ {8DE2053A-247B-430A-​86C3-E52B4725AA60}.R​elease|Any CPU.ActiveCfg = Release|Any CPU
+ {8DE2053A-247B-430A-​86C3-E52B4725AA60}.R​elease|Any CPU.Build.0 = Release|Any CPU
     EndGlobalSection
     GlobalSection(Soluti​onProperties) = preSolution
         HideSolutionNode = FALSE

Modified: trunk/src/TASKS.txt
Url: http://subview.tigri​s.org/source/browse/​subview/trunk/src/TA​SKS.txt?view=diff​&rev=11&p1=trun​k/src/TASKS.txt&​p2=trunk/src/TASKS.t​xt&r1=10&r2=​11
====================​====================​====================​==================
--- trunk/src/TASKS.txt (original)
+++ trunk/src/TASKS.txt 2006-08-15 16:59:34-0700
@@ -1,4 +1,12 @@
 
+Current "projects":
+* Adding Atlas support - this is a moving target as Atlas is not 100%
+ - Directory props are retreived from Atlas
+ - Current bug is only HEAD props are ever retreived.
+* Adding ATOM feed for directory logs
+ - Need note in README me about ATOM source
+ - Need way to do svn log -limit or feeds will be too expensive (it basically hangs for root directories)
+* Can we use AhnkSvn to get rid of need to do cmd line processing?
  
 Bugs:
 * Do a pass of looking at reshaper & XML comment issues
@@ -11,6 +19,7 @@
     At least don't crash if REV is larger than youngest
 
 Clean up:
+* We have both a subview and a Subview namespace?
 * Directory view needs cleaner layout (props header & props table look odd)
 * All viewers need comments added & code cleaned up
 * Add README for general description of code & project

Added: trunk/src/Utils/FeedUtils.cs
Url: http://subview.tigri​s.org/source/browse/​subview/trunk/src/Ut​ils/FeedUtils.cs?vie​w=auto&rev=11
====================​====================​====================​==================
--- (empty file)
+++ trunk/src/Utils/FeedUtils.cs 2006-08-15 16:59:34-0700
@@ -0,0 +1,79 @@
+using System;
+using System.Text;
+using System.Web;
+using subview.Subversion;
+using Atom.Core;
+
+namespace Subview.Utils
+{
+ /// <summary>
+ /// Class contains utilit functions for constructing Atom feeds
+ /// </summary>
+ public static class FeedUtils
+ {
+ /// <summary>
+ /// Give a Subview path to a directory and it's log generate a populated AtomFeed object.
+ /// </summary>
+ /// <param name="svnPath">​</param>
+ /// <param name="log"></param>
+ /// <returns></returns>
+ public static AtomFeed CreateFeedFromLog(string svnPath, SvnLog log)
+ {
+ // http://localhost:259​5/KeenDev/trunk/SRC/​Build/src/DbApi/?vie​w=atom
+ Uri foo = Atom.Utils.DefaultValues.Uri;
+ AtomFeed newFeed = new AtomFeed();
+ newFeed.Title = new AtomContentConstruct("title", "SVN Checkins");
+ newFeed.Tagline = new AtomContentConstruct​("subtitle", "Atom Feed created by SubView");
+ newFeed.Modified = new AtomDateConstruct("modified", DateTime.Now, TimeZone.CurrentTime​Zone.GetUtcOffset(Da​teTime.Now));
+
+ Uri selfUri = new Uri(svnPath + "?view=atom");
+ newFeed.Links.Add(new AtomLink(selfUri, Relationship.ServiceFeed, MediaType.ApplicationAtomXml));
+ newFeed.Id = selfUri;
+
+ foreach (LogEntry entry in log.LogEntries)
+ {
+ AtomEntry newEntry = new AtomEntry();
+ newEntry.Title = new AtomContentConstruct("title", GenerateSubject(entry)); // SHould perhaps truncate for a summary?
+ newEntry.Author = new AtomPersonConstruct("author", entry.Author);
+ newEntry.Issued = new AtomDateConstruct("issued", entry.Date, TimeZone.CurrentTime​Zone.GetUtcOffset(Da​teTime.Now));
+ newEntry.Modified = new AtomDateConstruct("modified", entry.Date, TimeZone.CurrentTime​Zone.GetUtcOffset(Da​teTime.Now));
+
+ Uri entryUri = new Uri(svnPath + "?view=rev&amp;rev=" + entry.Revision);
+ newEntry.Links.Add(new AtomLink(entryUri, Relationship.Alternate, MediaType.TextHtml));
+ newEntry.Id = entryUri;
+
+ AtomContent content = new AtomContent(HttpUtil​ity.HtmlEncode("<​pre>" + entry.Message + "</pre>"), MediaType.TextHtml, Mode.Xml);
+ newEntry.Contents.Add(content);
+ newFeed.Entries.Add(newEntry);
+ }
+
+ return newFeed;
+ }
+
+ private static string GenerateSubject(LogEntry entry)
+ {
+ const int MAX_SIZE = 80;
+
+ StringBuilder sb = new StringBuilder();
+
+ sb.Append(entry.Revision);
+ sb.Append(": ");
+
+ string message = HttpUtility.HtmlEnco​de(entry.Message);
+ int index = message.IndexOf("\n");
+ if (index < 4)
+ index = MAX_SIZE;
+ if (index < message.Length)
+ message = message.Substring(0, index);
+ sb.Append(message);
+
+ if (sb.Length > MAX_SIZE)
+ {
+ sb.Length = MAX_SIZE - 3;
+ sb.Append("...");
+ }
+
+ return sb.ToString();
+ }
+ }
+}

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

svn commit: r11 - trunk/src: . ATOM.Net/Atom.NET/tests/invalidentries/cvs Controls HttpHandlers Images Utils rayj Ray Johnson 2006-08-15 16:59:34 PDT
Messages per page: