Login | Register
My pages Projects Community openCollabNet

Discussions > commits > svn commit: r37 - trunk/src: . Controls Utils

subview
Discussion topic

Back to topic list

svn commit: r37 - trunk/src: . Controls Utils

Reply

Author rayj
Full name Ray Johnson
Date 2006-09-26 15:43:57 PDT
Message Author: rayj
Date: 2006-09-26 15:43:56-0700
New Revision: 37

Added:
   trunk/src/Controls/D​iffContent.cs
Modified:
   trunk/src/Controls/D​iffView.ascx
   trunk/src/Controls/D​iffView.ascx.cs
   trunk/src/Controls/D​iffView.ascx.designe​r.cs
   trunk/src/Subview.csproj
   trunk/src/TASKS.txt
   trunk/src/Utils/DiffToHTML.cs

Log:
Fixed bug in DiffView introduced by using strict DOCTYPE
Other small improvements


Added: trunk/src/Controls/D​iffContent.cs
Url: http://subview.tigri​s.org/source/browse/​subview/trunk/src/Co​ntrols/DiffContent.c​s?view=auto&rev=​37
====================​====================​====================​==================
--- (empty file)
+++ trunk/src/Controls/D​iffContent.cs 2006-09-26 15:43:56-0700
@@ -0,0 +1,25 @@
+using System.Web.UI;
+using System.Web.UI.WebControls;
+
+namespace subview.Controls
+{
+ public class DiffContent : PlaceHolder
+ {
+ string content = null;
+
+ /// <summary>
+ /// Set the HTML for the contents of the diff
+ /// </summary>
+ public string DiffContents
+ {
+ get { return content;}
+ set { content = value;}
+ }
+
+ protected override void Render(HtmlTextWriter writer)
+ {
+ if (content != null)
+ writer.Write(content);
+ }
+ }
+}

Modified: trunk/src/Controls/D​iffView.ascx
Url: http://subview.tigri​s.org/source/browse/​subview/trunk/src/Co​ntrols/DiffView.ascx​?view=diff&rev=3​7&p1=trunk/src/C​ontrols/DiffView.asc​x&p2=trunk/src/C​ontrols/DiffView.asc​x&r1=36&r2=3​7
====================​====================​====================​==================
--- trunk/src/Controls/D​iffView.ascx (original)
+++ trunk/src/Controls/D​iffView.ascx 2006-09-26 15:43:56-0700
@@ -2,4 +2,4 @@
 <%@ Register TagPrefix="Subview" NameSpace="subview.Controls" Assembly="subview" %>
 <asp:HyperLink ID="otherView" Runat="server" EnableViewState="Fal​se">Switch Views</asp:HyperL​ink>&nbsp;
 <Subview:LogViewLink ID="logLink" runat="server">View Log</Subview:LogV​iewLink><br />
-<asp:PlaceHolder id="placeHolder" runat="server" EnableViewState="Fal​se"></asp:Plac​eHolder>
+<Subview:DiffContent ID="diffContents" runat="server" />

Modified: trunk/src/Controls/D​iffView.ascx.cs
Url: http://subview.tigri​s.org/source/browse/​subview/trunk/src/Co​ntrols/DiffView.ascx​.cs?view=diff&re​v=37&p1=trunk/sr​c/Controls/DiffView.​ascx.cs&p2=trunk​/src/Controls/DiffVi​ew.ascx.cs&r1=36​&r2=37
====================​====================​====================​==================
--- trunk/src/Controls/D​iffView.ascx.cs (original)
+++ trunk/src/Controls/D​iffView.ascx.cs 2006-09-26 15:43:56-0700
@@ -2,7 +2,6 @@
 using System.IO;
 using System.Text.RegularExpressions;
 using System.Text;
-using System.Web.UI.WebControls;
 using subview.Subversion;
 using subview.Utils;
 
@@ -25,7 +24,11 @@
             FileType extensionInfo = new FileType(filePath);
             if (extensionInfo.ViewOption == ViewOption.Image || extensionInfo.ViewOption == ViewOption.Audio)
             {
- DoContentDiff(extens​ionInfo.ViewOption);​
+ string contentHtml = DoContentDiff(extens​ionInfo.ViewOption);​
+ foreach (DiffContent diffContent in CtrlUtil.FindControl​sOfType<DiffConte​nt>(this.Controls​))
+ {
+ diffContent.DiffContents = contentHtml;
+ }
                 return;
             }
 
@@ -33,9 +36,7 @@
             otherView.Visible = true;
             string diffData = Svn.Diff(SvnPath, rev1, rev2);
 
- Label contentLabel = new Label();
- contentLabel.EnableViewState = false;
-
+ string html;
             if (diffType == "vdiff")
             {
                 // Do a "visual diff" where files are shown side by side
@@ -52,7 +53,7 @@
                 DiffToHTML dtoh = new DiffToHTML(fileLines, diffLines);
                 StringWriter writer = new StringWriter();
                 dtoh.GenerateHTML(writer);
- contentLabel.Text = writer.ToString();
+ html = writer.ToString();
             }
             else
             {
@@ -64,7 +65,7 @@
                 StreamWriter sw = File.CreateText(tmpFile);
                 sw.Write(diffData);
                 sw.Close();
- string html = Enscript.GenerateHtm​lFromFile(tmpFile, "diffu");
+ html = Enscript.GenerateHtm​lFromFile(tmpFile, "diffu");
                 File.Delete(tmpFile);
 
                 // svn diff shows the revision numbers in the diff file
@@ -72,18 +73,19 @@
                 string pattern = @"\(revision (\d+)\)";
                 string replace = "(revision <a href=\"/" + Repository.Name + "/?view=rev&rev=​$1\">$1</a​>)";
                 html = Regex.Replace(html, pattern, replace);
-
- contentLabel.Text = html;
             }
 
- placeHolder.Controls​.Add(contentLabel);
+ foreach (DiffContent diffContent in CtrlUtil.FindControl​sOfType<DiffConte​nt>(this.Controls​))
+ {
+ diffContent.DiffContents = html;
+ }
         }
         
         /// <summary>
         /// Depending on the content type render the appropiate Diff visualization.
         /// </summary>
         /// <param name="contentType"​></param>
- public void DoContentDiff(ViewOption contentType)
+ public string DoContentDiff(ViewOption contentType)
         {
             otherView.Visible = false;
 
@@ -122,10 +124,7 @@
             sb.Append("</tr>\n");
             sb.Append("</table>\n");
 
- Label contentLabel = new Label();
- contentLabel.EnableViewState = false;
- contentLabel.Text = sb.ToString();
- placeHolder.Controls​.Add(contentLabel);
+ return sb.ToString();
         }
 
         /// <summary>

Modified: trunk/src/Controls/D​iffView.ascx.designe​r.cs
Url: http://subview.tigri​s.org/source/browse/​subview/trunk/src/Co​ntrols/DiffView.ascx​.designer.cs?view=di​ff&rev=37&p1​=trunk/src/Controls/​DiffView.ascx.design​er.cs&p2=trunk/s​rc/Controls/DiffView​.ascx.designer.cs​&r1=36&r2=37
====================​====================​====================​==================
--- trunk/src/Controls/D​iffView.ascx.designe​r.cs (original)
+++ trunk/src/Controls/D​iffView.ascx.designe​r.cs 2006-09-26 15:43:56-0700
@@ -13,6 +13,6 @@
     public partial class DiffView {
         protected System.Web.UI.WebCon​trols.HyperLink otherView;
         protected subview.Controls.LogViewLink logLink;
- protected System.Web.UI.WebCon​trols.PlaceHolder placeHolder;
+ protected subview.Controls.DiffContent diffContents;
     }
 }

Modified: trunk/src/Subview.csproj
Url: http://subview.tigri​s.org/source/browse/​subview/trunk/src/Su​bview.csproj?view=di​ff&rev=37&p1​=trunk/src/Subview.c​sproj&p2=trunk/s​rc/Subview.csproj​&r1=36&r2=37
====================​====================​====================​==================
--- trunk/src/Subview.csproj (original)
+++ trunk/src/Subview.csproj 2006-09-26 15:43:56-0700
@@ -102,6 +102,7 @@
     <Compile Include="Controls\B​lameViewLink.cs" />
     <Compile Include="Controls\CtrlUtil.cs" />
     <Compile Include="Controls\DateLabel.cs" />
+ <Compile Include="Controls\D​iffContent.cs" />
     <Compile Include="Controls\D​iffPreviousLink.cs" />
     <Compile Include="Controls\D​irectoryItemImage.cs​" />
     <Compile Include="Controls\D​irectoryItemLabel.cs​" />

Modified: trunk/src/TASKS.txt
Url: http://subview.tigri​s.org/source/browse/​subview/trunk/src/TA​SKS.txt?view=diff​&rev=37&p1=trun​k/src/TASKS.txt&​p2=trunk/src/TASKS.t​xt&r1=36&r2=​37
====================​====================​====================​==================
--- trunk/src/TASKS.txt (original)
+++ trunk/src/TASKS.txt 2006-09-26 15:43:56-0700
@@ -1,7 +1,7 @@
 Template thoughts:
     ItemLink - change DirItemLink -> ItemLink, Use ItemLink instead of SvnPathItemLink
             - same for ItemLabel & probably ItemImage
- DiffView - SwitchViewLink?, use LogViewLink, DiffContent, DiffDropDownChooser, DownLoadPatch?
+ DiffView - SwitchViewLink? or DiffDropDownChooser, DownLoadPatch?
         Other diff options: ColoredDiff w/ Legend, LongColoredDiff w/ Legend,
             Unidiff (our std diff), ContextDiff - do we even want it?, SideBySide (our cool diff)
             Our cool diff needs better control over floating control panel

Modified: trunk/src/Utils/DiffToHTML.cs
Url: http://subview.tigri​s.org/source/browse/​subview/trunk/src/Ut​ils/DiffToHTML.cs?vi​ew=diff&rev=37​&p1=trunk/src/Util​s/DiffToHTML.cs&​p2=trunk/src/Utils/D​iffToHTML.cs&r1=​36&r2=37
====================​====================​====================​==================
--- trunk/src/Utils/DiffToHTML.cs (original)
+++ trunk/src/Utils/DiffToHTML.cs 2006-09-26 15:43:56-0700
@@ -218,14 +218,14 @@
         private void emitHeader(StringWriter outstream)
         {
             // outstream.WriteLine(​"<HTML>");
- outstream.WriteLine(​"<STYLE>");
+ outstream.WriteLine("<style type=\"text/css\">");
             outstream.WriteLine("A {text-decoration:none;}");
             outstream.WriteLine(​"BLOCKQUOTE.added { margin: 0em 0em 0em 0em ; color: green ; background:#D0D0D0}");
             outstream.WriteLine(​"BLOCKQUOTE.deleted { margin: 0em 0em 0em 0em ; color: red ; background:#D0D0D0}");
             outstream.WriteLine(​"BLOCKQUOTE.changed { margin: 0em 0em 0em 0em ; color: blue ; background:#D0D0D0}");
             outstream.WriteLine(".left { height: 102%; width:100% ;overflow-x: scroll; float:left; overflow:auto; background:white;}");
             outstream.WriteLine(".right { height: 102%; width:100%; overflow-x: scroll; background:white; overflow:auto; float:left; border-left: medium solid black;}");
- outstream.WriteLine(​"</STYLE>");
+ outstream.WriteLine(​"</style>");
     
             emitController(outstream);
     
@@ -243,23 +243,23 @@
 
         private void emitController(StringWriter outstream)
         {
- outstream.WriteLine(​"<style>");
+ outstream.WriteLine("<style type=\"text/css\">");
             outstream.WriteLine(​"#controller{");
             outstream.WriteLine(​"position:absolute;"​);
             outstream.WriteLine("width: 100px;");
             outstream.WriteLine("right: 20px;");
             outstream.WriteLine("top: 20px;");
- outstream.WriteLine("border: 1px solid black;");
- outstream.WriteLine(​"background-color: lightyellow;");
+ outstream.WriteLine("border: 1px solid black;");
+ outstream.WriteLine(​"background-color: lightyellow;");
             outstream.WriteLine("padding: 4px;");
             outstream.WriteLine("z-index: 100;");
             outstream.WriteLine("}");
             outstream.WriteLine(​"#cscroll{");
- outstream.WriteLine(​"height:40;");
- outstream.WriteLine(​"width:90;");
+ outstream.WriteLine(​"height:40px;");
+ outstream.WriteLine(​"width:90px;");
             outstream.WriteLine(​"z-index:195;");
- outstream.WriteLine(​"overflow:auto;");
- outstream.WriteLine("}");
+ outstream.WriteLine(​"overflow:auto;");
+ outstream.WriteLine("}");
             outstream.WriteLine(​"</style>");
             // outstream.WriteLine(​"<BODY>");
             outstream.WriteLine("<DIV id=\"controller\">");
@@ -269,10 +269,10 @@
             outstream.WriteLine("<a href=\"javascript:s​howright()\">[R]​</a><BR />");
             outstream.WriteLine("<a href=\"javascript:p​revchange()\">[P​]rev</a>");
             outstream.WriteLine("<a href=\"javascript:n​extchange()\">[N​]ext</a>");
- outstream.WriteLine("<div id=\"cscroll\" onscroll=\"javascri​pt:scrollboth()\"​>");
- outstream.WriteLine("<div id=\"inner\" style=\"width:270\" >");
- outstream.WriteLine(​"</div>");
- outstream.WriteLine(​"</div>");
+ outstream.WriteLine("<div id=\"cscroll\" onscroll=\"javascri​pt:scrollboth()\"​>");
+ outstream.WriteLine("<div id=\"inner\" style=\"width:270px\" >");
+ outstream.WriteLine(​"</div>");
+ outstream.WriteLine(​"</div>");
             outstream.WriteLine(​"</div>");
             outstream.WriteLine(​"</DIV>");
         }

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

Messages

Show all messages in topic

svn commit: r37 - trunk/src: . Controls Utils rayj Ray Johnson 2006-09-26 15:43:57 PDT
Messages per page: