Strip whitespace from STMP server names.

The STMP server configuration would fail if there was trailing whitespace on the
server name. This was a problem when copy/pasting text into the form.

Testing done:
Produced the bug with an smtp server "smtp.gmail.com     " and triggered an
email event (registration for new user). Log produced an error: "Unknown host".
Added the changes on the diff and tried again, the email is sent and the value
that is saved is stripped of the redudant spaces.

Reviewed at http://reviews.reviewboard.org/r/3759/
Fixes bug 2620.
Fix static media URLs when running the devel server with a SITE_ROOT.

The way that static media URLs ('/static/' and '/media/') were mapped when a
SITE_ROOT was defined was problematic, in that it was appending the SITE_ROOT
twice in the urlspec. The problem is that all the URLs were created with the
root prepended, but the way that settings.py defined the urls didn't have the
right distinctions between the names of the directories and the URL paths.

Testing done:
Tested that loading the dashboard included all static media with a SITE_ROOT of
both '/' and '/example/'.
Merge branch 'release-1.7.x'
Add test: Expect 404 on invalid review access.

In particular, test if accessing the screenshots of a nonexistent review id
fails.

Testing done: Test passes with http://reviews.reviewboard.org/r/3767 applied.

Fixes bug 2551.
Reviewed at http://reviews.reviewboard.org/r/3761/
Expand review when jumping to comment from issue table.

When clicking on an issue in the issue table, we bring the user to the
associated comment. This wasn't working if the comment was part of a review
that had been collapsed. Now we expand the appropriate review before sending
the user to the comment.

Fixes issue #3770.
Assert that a comment is passed to CommentDialogView.

At some point before committing my CommentDialogView change, logic
leading to an assertion moved, which we needed to ensure that there was
some comment passed to CommentDialogView. The assertion is now added to
CommentDialogView.create, which first references the comment.
The "Posted Time" should be the time of publish.

Currently, the time_added of a review request is setup when a new record is
added. If there is a time difference between the creation time and the time of
actually publishing the review request, the field is not updated and it shows
the time of creation as the "Posted" time. This is fixed by updating the
"time_added" field to current time when a review request is published.

Testing done: Manual, Ran all tests to ensure no other breakage.

Reviewed at http://reviews.reviewboard.org/r/3753/
Fixes bug 1897.
Fix the settings import in the search index management command.

"import settings" should have been "from django.conf import settings".

Fixes bug 2872.
Clean up the name and spacing in the VersionOne code.

The VersionOne code had some spacing and trailing whitespace problems,
and also listed the service as "versionone" and not "VersionOne".
Don't show "Add comment" button if not logged in

This is for file upload reviews. Before, the button was there, but did nothing
for anonymous users. Also, fix some template tag indentation

Testing done: Checked if the button is gone for anonymous users and still there
for logged-in users. No failed tests.

Reviewed at http://reviews.reviewboard.org/r/3773/
Fixed bug allowing a request to be published with empty summary fields.

In the publish request page, if you filled the summary or description field then
deleted the contents, the fields would not be updated but the ReviewRequest
object would be updated.  This allowed a request to be published with empty
fields although the page showed they were not empty.

The fields are now emptied to then be filled with the new contents, avoiding
this issue.

Testing done: Checked in browser that the summary and description fields are
updated if you empty the field.  The Web UI does not allow the request to be
published after the field is emptied.

Reviewed at http://reviews.reviewboard.org/r/3760/
Fixes bug 2870.
Support localized revision strings in svn diffs.

If the host is running in a non-C locale, 'svn diff' will produce a diff with
the revision strings localized. Unsurprisingly, this would fail to parse
correctly. post-review already handles this by always invoking svn with LANG=C,
but if someone uploaded a diff manually, it would still break. This change adds
all the different localizations of "revision" to the regular expression that we
use for parsing.

Testing done: ran added unit tests

Reviewed at http://reviews.reviewboard.org/r/3749/
Fix "Review ID" column in the dashboard datagrid with a local site.

The review ID column would properly select which database field to access,
except DashboardDataGrid was popping the "local_site" value out of kwargs before
delegating to ReviewRequestDataGrid.

Testing done:
Created a local site and published a review request to it. Before this change, I
saw a review ID of "5" even though the URL was /s/test-site/r/1/. After this
change, saw a review ID of "1" in the dashboard.

Reviewed at http://reviews.reviewboard.org/r/3786/
Fix "Review ID" column in the dashboard datagrid with a local site.

The review ID column would properly select which database field to access,
except DashboardDataGrid was popping the "local_site" value out of kwargs before
delegating to ReviewRequestDataGrid.

Testing done:
Created a local site and published a review request to it. Before this change, I
saw a review ID of "5" even though the URL was /s/test-site/r/1/. After this
change, saw a review ID of "1" in the dashboard.

Reviewed at http://reviews.reviewboard.org/r/3786/
Merge branch 'release-1.6.x' into release-1.7.x
Merge branch 'release-1.7.x'
Send email when closing review requests

Optionally send emails when closing review requests. Add a flag in the Email
settings page that will allow for sending emails when a review request is closed
(Submitted/Discarded).

Files Changed:
reviewboard/admin/forms.py
+ Added Boolean to store the value of "mail_send_review_close_mail" in settings

reviewboard/notifications/email.py
+ Added callback method for review_request_closed signal

reviewboard/templates/notifications/review_request_email.html
reviewboard/templates/notifications/review_request_email.txt
+ Added code to display the "Status" of the review request when it's closed
  before the "Description" section.

Tests:
+ Added test for review request closing
+ Modified other review related tests to fix counts or expected results

Testing done: Added test for this feature and ran all tests. Verified in UI.

Fixes bug 422
Reviewed at http://reviews.reviewboard.org/r/3707/
Add a capability to indicate support for Perforce moved files.

1.7.2 introduced moved file support for Perforce, but there wasn't a
good way for RBTools to really detect this that retained compatibility
with previous versions of Review Board. The reason is that we relied
upon the existing general diffs.moved_files capability, causing RBTools
to generate diffs for older releases that ended up being incompatible.

This introduces a scmtools.perforce.moved_files cap that can be used
instead. 1.7.3 will be the minimum version of Review Board that will
support moved files for Perforce with RBTools.
Add a new BaseResource model that will be used by all API models.

The BaseResource model provides all the common functionality for dealing
with requests and parsing results, ensuring a model is ready to use (has
its data fetched) before we do anything with it, and being able to
ensure it's created before using it. These models have a concept of a
parent resource that they're under (for example, a diff being under a
review draft).

This change just introduces this model and a suite of unit tests for it.
We'll move over to this in subsequent commits.
Merge branch 'release-1.7.x'