C# Class Malevich._Default

Implementation of the Malevich code review web site.
Inheritance: System.Web.UI.Page
Mostra file Open project: daptiv/Malevich

Private Properties

Property Type Description
AbbreviateToOneLine string
AddAttachmentRow void
AddCommentToCell void
AddDisplayReviewControls void
AddJScriptCreateCommentOnClickAttribute void
AddLabel System.Web.UI.WebControls.Label
AddLink System.Web.UI.WebControls.HyperLink
AddToReviewers void
ApplyRowBackgroundCssStyle void
BuildNavigationTable void
ComputeMoniker string
ComputeMoniker string
CreateLinkButton System.Web.UI.WebControls.HyperLink
CreateReviewsSectionCommon System.Web.UI.WebControls.WebControl
DisplayAllOpenReviews void
DisplayAllReviews void
DisplayChange void
DisplayDiff void
DisplayFile void
DisplayHelp void
DisplayMyReviews void
DisplayPageHeader void
DisplayReview void
DisplayReviewHistory void
DisplayReviewLineComments int
DisplayReviewsCommon void
DisplayReviewsForUser void
DisplaySettings void
DisplayStats void
DownloadFile void
EncodeLineTextAndComments IEnumerable
EncodeLineTextAndComments IEnumerable
EncodeLineTextAndComments IEnumerable
ErrorOut void
GenerateFileDiffView System.Web.UI.Control
GetBaseReviewId int
GetChangeDescriptionRow System.Web.UI.WebControls.TableRow
GetChangeFileRow System.Web.UI.WebControls.TableRow
GetChangeListStatus ChangeListStatus
GetComments AbstractedComment[]
GetEncoderForFile ILineEncoder
GetFileStream StreamCombiner
GetLastReview Review
GetLatestUserReviewForChangeList Review
GetLineAndComments LineAndComments
GetReviewRow System.Web.UI.WebControls.TableRow
GetSourceControlId int
GetUnchangedLinesBreak Malevich.Util.TableGen.Row
GetVersionsAbstract AbstractedFileVersion[]
GetVersionsWithTextAbstract AbstractedFileVersion[]
IsChangeListNeedsWork bool
RedirectToChange void
SaveToTempFile System.IO.TempFile
WrapDateStamp string
WrapTimeStamp string
changeUserPrefs_Clicked void
selectVersions_Clicked void
submitReview_Clicked void

Public Methods

Method Description
AddFileSecurity ( string fileName, WellKnownSidType account, FileSystemRights rights, AccessControlType controlType ) : void

Adds an ACL entry on the specified file for the specified account.

Dispose ( ) : void

Overrides the dispose function to get rid of the database connection context.

RenderFooterSkin ( ) : void

Inserts the footer HTML file into the table. This allows skinning (branding) of Malevich to integrate it seamlessly into existing tool chain. The text of the file are dumped in the very end of the table as is.

RenderHeaderSkin ( ) : void

Inserts the header HTML file into the table. This allows skinning (branding) of Malevich to integrate it seamlessly into existing tool chain. The text of the file are dumped in the very beginning of the table as is.

RenderHintScriptSupport ( ) : void

Data for the javascript hints.

RenderStyle ( ) : void

Renders the dynamic elements of the style. This is stricly the sizing part of the diff table at the moment. It only is used on that table.

_Default ( ) : System

Trivial constructor. Initializes key constants from the AppSettings section.

Protected Methods

Method Description
Page_Load ( object sender, EventArgs e ) : void

Generates the table. This is the main entry point.

Private Methods

Method Description
AbbreviateToOneLine ( string text, int maxLineLen ) : string

Abbreviates text to a given number of characters. Also combines multiple lines in a single one (replaces EOL characters with spaces. It does not pay attention to the word breaks. HtmlEncodes the results.

AddAttachmentRow ( System.Web.UI.WebControls.Table page, Attachment attachment ) : void

Displays files from a change list by adding a row with details regarding the file to a table.

AddCommentToCell ( StringBuilder sbOut, AbstractedComment comment, string prefix ) : void

Appends a comment. The HTML structure produced by this function MUST be kept in sync with the one produced by createNewComment in comments.js.

AddDisplayReviewControls ( Review review, ChangeList change, string action, int uniquefier ) : void

AddJScriptCreateCommentOnClickAttribute ( WebControl ctrl ) : void

Will add the attribute to trigger a call to onMouseClick in comments.js.

AddLabel ( string contents ) : System.Web.UI.WebControls.Label

Creates and adds a new label to the active page.

AddLink ( string label, string query ) : HyperLink

Creates and adds a new hyperlink to the active page.

AddToReviewers ( int cid, string userName ) : void

AddText a user to the list of reviewers.

ApplyRowBackgroundCssStyle ( System.Web.UI.WebControls.Table table ) : void

Used to create alternating row shading, if desired, within the .css file.

BuildNavigationTable ( ChangeFile file, IQueryable files, int vid1, int vid2, bool ignoreWhiteSpaces, int tableIndex ) : void

Creates a row of links with the next targets for the file view.

ComputeMoniker ( string name, AbstractedFileVersion version ) : string

Computes the displayed name of the file version. Should be kept in sync with the FileVersion version.

ComputeMoniker ( string name, FileVersion version ) : string

Computes the displayed name of the file version. Should be kept in sync with the AbstractFileVersion version.

CreateLinkButton ( string text, string url ) : HyperLink

Create a link that has the appearance of a button. Currently disabled, as display does not quite work right.

CreateReviewsSectionCommon ( string sectionTitle, IEnumerable reviews, bool includeReviewOwner, bool includeCoseButton = false ) : WebControl

Common code for emitting sets of changes for use in the dashboard view.

DisplayAllOpenReviews ( ) : void

Displays currently active reviews for the team.

DisplayAllReviews ( ) : void

Displays the review history (all reviews for the team).

DisplayChange ( int cid, string userName ) : void

Displays the change list composition. This is called when the main table shows the details of one change list.

DisplayDiff ( FileVersion left, FileVersion right, string name, int baseReviewId, bool ignoreWhiteSpaces ) : void

Computes and displays the diff between two distinct versions. Uses unix "diff" command to actually produce the diff. This is relatively slow operation and involves spooling the data into two temp files and running an external process.

DisplayFile ( int fid, string userName, int vid1, int vid2, bool ignoreWhiteSpace ) : void

Displays one or two versions of a file in a diff-like view.

DisplayHelp ( string sourceUrl ) : void

Displays context-sensitive help.

DisplayMyReviews ( string userName ) : void

Displays all the changes by the user as well as the ones the user was asked to review.

DisplayPageHeader ( string title ) : void

Displays the header for a page.

DisplayReview ( int rid, string action, string userName ) : void

Displays the review. If action is "confirm", allows user to submit or cancel it.

DisplayReviewHistory ( string alias, string userName, bool author ) : void

Displays review history for a user.

DisplayReviewLineComments ( int myReviewId ) : int

Lists the comments made in various files.

DisplayReviewsCommon ( string userName, bool userIsMe, string usersChangesTitle, string usersPendingReviewsTitle, string usersCompletedReviewsTitle, string recentHistoryTitle ) : void

Common part for displaying the user dashboard.

DisplayReviewsForUser ( string userName ) : void

Displays all the changes by the user as well as the ones the user was asked to review.

DisplaySettings ( string sourceUrl ) : void

Displays and allows changing user preferences.

DisplayStats ( string sourceUrl, string history ) : void

Displays statistics

DownloadFile ( int vid ) : void

Downloads a version of a file.

EncodeLineTextAndComments ( DiffFileInfo file ) : IEnumerable

Generates the HTML that represents the current line and any associated comments.

EncodeLineTextAndComments ( ILineEncoder encoder, string prefix, LineAndComments line ) : IEnumerable

Writes out one line and comments, if any.

EncodeLineTextAndComments ( ILineEncoder encoder, string prefix, int lineNumber, string lineText, AbstractedComment comments, int &commentIndex ) : IEnumerable

Writes out one line and comments, if any.

ErrorOut ( string errorReport ) : void

Display the error report.

GenerateFileDiffView ( StreamCombiner baseFile, int baseId, AbstractedComment baseComments, string baseHeader, StreamCombiner diffFile, int diffId, AbstractedComment diffComments, string diffHeader, bool baseIsLeft, StreamCombiner rawDiff, string fileName ) : Control

Generates the diff view for two file revisions.

GetBaseReviewId ( string userName, int changeId ) : int

Returns the id for the current open review for the given user, or 0 if it does not exist.

GetChangeDescriptionRow ( string title, string body ) : System.Web.UI.WebControls.TableRow

Returns a row with title and body as two cells.

GetChangeFileRow ( DataModel file, AbstractedFileVersion lastVersion, bool hasTextBody, Review latestReview ) : System.Web.UI.WebControls.TableRow

Displays files from a change list by adding a row with details regarding the file to a table.

GetChangeListStatus ( ChangeList changeList ) : ChangeListStatus

Get the ChangeListStatus for the provided changelist, can be Pending, Needswork, or Closable. Does not check if changelist stage is closed.

GetComments ( int fileVersionId, int baseReviewId ) : AbstractedComment[]

Returns an array of comments for a given version. Comments either belong to a specific review id, or to all submitted comments against this version. The array is sorted according to line number, and then line stamp.

GetEncoderForFile ( string fileName ) : ILineEncoder

Returns an encoder for a given file name.

GetFileStream ( FileVersion version ) : StreamCombiner

Produces a stream for a file version. This may involve reading the database for the base for the version, if the version is a diff.

GetLastReview ( int changeListId, string userName ) : Review

Gets the very last submitted review for a given user.

GetLatestUserReviewForChangeList ( string userName, int changeListId ) : Review

Returns the latest review of a changelist by a particular user.

GetLineAndComments ( DiffFileInfo file ) : LineAndComments
GetReviewRow ( ChangeList changeList, bool includeUserName, bool includeCloseButton = false ) : System.Web.UI.WebControls.TableRow

Populates one row of data with the details of the passed change list. Used when displaying the list of change lists in review. Called for both the CLs where the user is the reviewer, as well as the reviewee.

GetSourceControlId ( ) : int

Returns the source control id for the current web site, or -1, if the web site does not match.

GetUnchangedLinesBreak ( int columnCount ) : Malevich.Util.TableGen.Row

Returns a row that indicates that an unchanged portion of the file has been omitted.

GetVersionsAbstract ( int fid ) : AbstractedFileVersion[]

Gets the abstracted list of file versions (everything except for the actual text).

GetVersionsWithTextAbstract ( int fid ) : AbstractedFileVersion[]

Gets the abstracted list of file versions that contain text (everything except for the actual text).

IsChangeListNeedsWork ( ChangeList changeList ) : bool

Determine if the ChangeList has Needs Work status. Should be run after checking in the changelist is Pending. A changelist needs work if one or more reviewers have commented 'NeedsWork' as their last comment. Non-scoring comments and UnmarkedComments do not count.

RedirectToChange ( int cid, string cl ) : void

Generates HTML to redirect the user to the change list table.

SaveToTempFile ( FileVersion version ) : System.IO.TempFile

Saves the text of a file version to a temp file.

WrapDateStamp ( System.DateTime ts ) : string

Same as WrapTimeStamp but only displays the date

WrapTimeStamp ( System.DateTime ts ) : string

Creates a string representation of a timestamp. This can later be processed by JavaScript to covert from UTC to local.

changeUserPrefs_Clicked ( object sender, EventArgs e ) : void

Saves the change in user prefs.

selectVersions_Clicked ( object sender, EventArgs e ) : void

Processes the selection of different file version(s) for displaying in diff pane. Called during the postback. Redirects to a table with query string specifying the new file versions.

submitReview_Clicked ( int changeId, object sender, EventArgs e ) : void

Submits the overall review. This is really called from inside a closure that is a true event handler. The idea is to mix the changeId in.

Method Details

AddFileSecurity() public static method

Adds an ACL entry on the specified file for the specified account.
public static AddFileSecurity ( string fileName, WellKnownSidType account, FileSystemRights rights, AccessControlType controlType ) : void
fileName string File name.
account WellKnownSidType The sid for the account.
rights FileSystemRights What rights to grant (e.g. read).
controlType AccessControlType Grant or deny?
return void

Dispose() public method

Overrides the dispose function to get rid of the database connection context.
public Dispose ( ) : void
return void

Page_Load() protected method

Generates the table. This is the main entry point.
protected Page_Load ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
return void

RenderFooterSkin() public method

Inserts the footer HTML file into the table. This allows skinning (branding) of Malevich to integrate it seamlessly into existing tool chain. The text of the file are dumped in the very end of the table as is.
public RenderFooterSkin ( ) : void
return void

RenderHeaderSkin() public method

Inserts the header HTML file into the table. This allows skinning (branding) of Malevich to integrate it seamlessly into existing tool chain. The text of the file are dumped in the very beginning of the table as is.
public RenderHeaderSkin ( ) : void
return void

RenderHintScriptSupport() public method

Data for the javascript hints.
public RenderHintScriptSupport ( ) : void
return void

RenderStyle() public method

Renders the dynamic elements of the style. This is stricly the sizing part of the diff table at the moment. It only is used on that table.
public RenderStyle ( ) : void
return void

_Default() public method

Trivial constructor. Initializes key constants from the AppSettings section.
public _Default ( ) : System
return System