Clean up the look of review UI pages.

Review UI pages were pretty ugly. They had this bit of the review
request box sticking out with nothing but the caption. This was from
back when we filled that with the screenshot list.

Now, by default, a review UI using the default.html template or the
`review_ui_content_box` block will have its UI shown in the confines of
that box. It has the whole area to play with, and isn't restricted by
any padding or UI elements. It will automatically have the actions
drop-down right above it as well.

Review UIs not using this template or block will appear below as before.
In this case, though, the bit of box will be removed, showing just the
action bar, cleanly floating there.

One side-effect of this is that the caption is no longer shown
automatically. It's now up to the review UI to decide how to show this.
Fix the z-index for the modal dialogs.

A recent change to Djblets removed the custom z-index from modal
dialogs, as they were just a guess and could often be wrong. This is a
counterpart to that change that just sets the z-index to be fit in the
most appropriate space in our z-index ordering.
Fix search support with a blank index file stored in settings.

Older installs that have a blank "search_index_file" setting would cause
Haystack to break. This is a trivial fix that falls back to the default
index file path if the setting is blank.
Move some useful code for the diff viewer UI into central locations.

This takes some of the stuff from the diff viewer that my upcoming
text-based review UI change needs and moves them into more useful
places.

The lesscss definitions in diffviewer.less have been moved into
defs.less, making it easier to match up styles.

The multi-line comment selector for the diff viewer tables has also been
pulled out into a new RB.TextCommentRowSelector class, which other
review UIs can trivially use.
Add support for generic text-based review, and improve Markdown review.

This adds support for reviewing any kind of text-based file attachment.
The UI is much like the diff viewer. We present the file, syntax
highlighted, with line numbers on the side. Users can comment on a line
or on multiple lines at a time.

TextReviewUI and its JavaScript counterparts drive the whole review
process. They're also intended to be subclassable. The Markdown review
UI is now just a small subclass of TextReviewUI.

TextReviewUI and friends can optionally present the content both as
raw source text and as rendered content. The user will see two tabs when
rendered content is available, and can comment on each the source text
or the rendered text. Markdown makes use of this. In the future, we
could add simple subclasses for other formats, like XML or JSON files.

Since DiffCommentBlockView and TextBasedCommentBlockView are basically
the same, I've moved most of the logic into TextBasedCommentBlockView.
DiffCommentBlockView is now just a simple subclass.

There's also a few fixes for rendering thumbnails, extra data for review
UIs, and a couple new blocks to give custom review UI templates some
additional control.
Fix Markdown rendering issues with the new field support.

The new field support didn't convert new review requests to Markdown,
yet it would escape the text. The result was seeing an uploaded
description in escaped Markdown.

We want to always render the built-in Description and Testing Done
fields in Markdown. To do this, there's now an `always_render_markdown`
attribute on the field that ensures the result will always be Markdown.
This will still factor in whether the source text needs to be escaped or
not.
Improve rendering of text-based file attachment thumbnails.

This applies syntax highlighting and decent rendering for text-based
file attachment thumbnails. Like the review UIs, these are now
syntax-highlighted. The text is also made small enough to show roughly 7
lines.
Fix a bad return from convert_to_unicode.

The recent cleanup in convert_to_unicode returned one value instead of a
tuple for one of the conditionals. It now returns the encoding along
with the value.
Fix issues with Git defaults and SVN file access for Beanstalk.

There were a couple Beanstalk-related issues that were hit in the wild.

The first is that the default repository path for Git repositories was
wrong. People generally didn't notice due to the REPOSITORY= entry in
.reviewboardrc, and since we don't actually use it for anything but
path-based matching.

The second, and more important, is that Subversion flat-out didn't work.
It was using the Beanstalk blob API, which throws an HTTP 500 for
Subversion. I thought this had worked in the past, but it's possible it
regressed. Either way, simple change to make the blob API Git-only.

While at it, I also improved the speed of file checks by not passing any
?contents= to the URL unless we did want contents. It seems the API is
currently treating ?contents=0 the same as ?contents=1.
Merge branch 'release-1.7.x'
Improve the look and feel of the file attachment thumbnails.

The file attachment thumbnails were looking a bit "busy." This attempts
to simplify it and make things more usable in a few ways:

1) Thumbnails are now of a fixed size, so that they nicely fit into a
   grid.

2) The borders have been lightened, and the background for the caption
   has been removed. Instead of the background, there's a very faint
   border above it, in order to provide the simplest of separation.

3) The red "X" for deleting a file attachment has been removed. Instead,
   a black-and-white trashcan icon has been added as an action item
   alongside "Review."

4) Any part of a filename that gets cut off will be ellipsized on modern
   browsers (or just hidden on older ones).

5) The pencil icon is now on the right of the caption area, instead of
   right up against the text.

6) The edit field for the caption now spans the width of the caption
   area, and doesn't have an ugly focus border around it.

7) A new tooltip appears over the thumbnail overlay saying "Click to
   review."

This also renames the "File Attachments" section to "Files," as files
are going to be more important in the future, and "attachments" makes it
feel less first-class.
Optimize queries when publishing or discarding review drafts.

Our Review publishing and discarding code was very inefficient. During
publish, we'd do 3 queries (one for every comment type), then a save on
each instance of a comment, which would end up doing an update of a
ReviewRequest per-comment. During delete, we'd do the 3 queries plus a
delete on each instance.

We now do 3 queries for publishing comments, and 3 for deleting.
Clean up PyFlakes warnings and errors.

We've let the cruft build for a while. This cleans it up. PyFlakes is
much happier now, and it's easier to spot issues with newer changes.
Depend on Django Evolution 0.7 beta 1.

This adds a dependency for 0.7 beta 1, and adds the new download URL to
the path for dependencies. It should now fetch automatically when
installing Review Board.
Release Review Board 1.7.21.
Merge branch 'release-1.7.x'
Fix rendering text-based attachments without a matching lexer.

It's possible to not find a valid lexer when attempting to render
a file attachment. To deal with that, we now fall back on an instance of
TextLexer(), which just simply renders the text safely to HTML.

This applies to both thumbnails and the review UI.
Split up reviews/models.py into multiple files.

models.py was getting too huge and unmaintainable. In order to keep
things sane, it has been split up into one file per class.

This is more of an implementation detail, as callers are welcome to
continue importing from reviewboard.reviews.models. Django itself only
looks in this module for models anyway.

The code is mostly left unchanged, though there are a few changes:

* To resolve circular dependencies, many ModelName.DoesNotExist
  exceptions have been replaced with ObjectDoesNotExist, and
  some imports were added to functions (at most one per file though,
  and only in a couple files).

* Some old docstrings have been fixed up to have a one-line summary.

* Added `app_label = "reviews"` to a much of Meta classes. This is
  required to tell Django that it's in the "reviews" module.
Fixed rendering changed field information in change descriptions.

The fields change over-escaped values when rendering. This was a
last-minute change made during review, due to the naming choices for the
functions and variables.

I've removed escaping for the change description values, which were all
rendering safely to HTML except for one. I've also updated the function
names to more explicitly state that they are providing valid HTML.
Fix working with file attachment drafts.

File attachment drafts were a bit broken. The API would return the
non-draft version, meaning it would contain the old caption and not the
new caption. We didn't notice this before the JavaScript rewrite,
because we just showed the local caption we saved, but this is more
apparent now.

The server-side resource now specifically serializes the resulting file
attachment using itself instead of the default serializer.

The JavaScript side now has a DraftFileAttachment object that's used for
all file attachments on the review request page. This is just a thin
wrapper around FileAttachment that makes use of the draft resource.