コード例 #1
0
ファイル: Default.aspx.cs プロジェクト: daptiv/Malevich
		/// <summary>
		/// Displays files from a change list by adding a row with details regarding the file to a table.
		/// </summary>
		/// <param name="file"> The top-level file data (names). </param>
		/// <param name="lastVersion"> The last version of the file. </param>
		/// <param name="hasTextBody"> Whether to display the file as a hyperlink </param>
		/// <param name="latestReview">The latest review that the user has submitted for this changelist. May be null.</param>
		private TableRow GetChangeFileRow(
			DataModel.ChangeFile file,
			AbstractedFileVersion lastVersion,
			bool hasTextBody,
			Review latestReview)
		{
			TableRow row = new TableRow();
			if (!file.IsActive)
				row.AppendCSSClass("CssInactiveFile");

			TableCell cell = new TableCell();
			// If the latest version of this file has a timestamp greater than the latest review,
			// then present a "new!" icon in the list to allow the user to quickly determine what
			// has changed since they last reviewed this change.
			if (latestReview != null &&
				lastVersion.TimeStamp != null &&
				latestReview.TimeStamp.CompareTo(lastVersion.TimeStamp) < 0)
			{
				cell.AppendCSSClass("CssNewIcon");
				cell.Controls.Add(new Image()
				{
					ImageUrl = "~/images/new_icon.png",
					AlternateText = "This file has changed since your last review submission."
				});
			}
			row.Cells.Add(cell);

			cell = new TableCell();
			row.Cells.Add(cell);

			string moniker = null;
			if (lastVersion == null)
			{
				moniker = file.ServerFileName + "#" + " (no versions found)";
			}
			else if (lastVersion.Action == SourceControlAction.DELETE)
			{
				moniker = file.ServerFileName + "#" + lastVersion.Revision + " DELETE";
			}
			else if (lastVersion.Action == SourceControlAction.BRANCH)
			{
				moniker = file.ServerFileName + "#" + lastVersion.Revision + " BRANCH";
			}
			else if (lastVersion.Action == SourceControlAction.INTEGRATE)
			{
				moniker = file.ServerFileName + "#" + lastVersion.Revision + " INTEGRATE";
			}
			else if (lastVersion.Action == SourceControlAction.RENAME)
			{
				moniker = file.ServerFileName + "#" + lastVersion.Revision + " RENAME";
			}
			else
			{
				moniker = file.ServerFileName + "#" + lastVersion.Revision +
					((lastVersion.Action == SourceControlAction.ADD) ? " ADD" : " EDIT");
			}

			if (hasTextBody)
			{
				HyperLink link = new HyperLink();
				cell.Controls.Add(link);
				link.NavigateUrl = Request.FilePath + "?fid=" + file.Id;
				link.Text = moniker;
			}
			else
			{
				cell.Text = moniker;
			}

			return row;
		}
コード例 #2
0
ファイル: Default.aspx.cs プロジェクト: daptiv/Malevich
		/// <summary>
		/// Computes the displayed name of the file version.
		/// Should be kept in sync with the FileVersion version.
		/// </summary>
		/// <param name="name"> The base name of a file (excluding the path). </param>
		/// <param name="version"> The version. </param>
		/// <returns> The string to display. </returns>
		private string ComputeMoniker(string name, AbstractedFileVersion version)
		{
			StringBuilder sb = new StringBuilder();
			sb.Append(name);
			sb.Append('#');
			sb.Append(version.Revision.ToString());
			if (!version.IsRevisionBase)
			{
				if (version.TimeStamp != null)
					sb.Append(" " + WrapTimeStamp(version.TimeStamp.Value) + " ");
				if (version.Action == SourceControlAction.ADD)
					sb.Append(" ADD ");
				else if (version.Action == SourceControlAction.EDIT)
					sb.Append(" EDIT ");
				else if (version.Action == SourceControlAction.DELETE)
					sb.Append(" DELETE ");
				else if (version.Action == SourceControlAction.BRANCH)
					sb.Append(" BRANCH ");
				else if (version.Action == SourceControlAction.INTEGRATE)
					sb.Append(" INTEGRATE ");
				else if (version.Action == SourceControlAction.RENAME)
					sb.Append(" RENAME ");
			}

			return sb.ToString();
		}