{% load i18n %}
<div class="box-head">
 <h1 class="box-title">{% trans "Data directory changes" %}</h1>
</div>
<div class="box-main">
 <p>
{% blocktrans %}
  Your site's data directory isn't properly set up. This directory is where
  Review Board will store various state and configuration needed to access
  repositories.
{% endblocktrans %}
 </p>
{% if data_dir == "" %}
 <p>
{% blocktrans %}
  The current data directory wasn't able to be found. Please ensure you
  have a <tt>data</tt> directory inside your site's directory, and that it
  is writable by the web server. Then ensure that your web server's
  configuration has the <tt>HOME</tt> environment variable set to the
  data directory.
{% endblocktrans %}
 </p>
{% else %}
 <p>
{% blocktrans %}
  Your data directory is currently at: <tt>{{data_dir}}</tt>
{% endblocktrans %}
 </p>
{%  if expected_data_dir != data_dir %}
 <h3>{% trans "Non-standard directory name used" %}</h3>
 <p>
{% blocktrans %}
  The data directory is not where we expect it. Unless you have a very
  custom setup, it should probably be at <tt>{{expected_data_dir}}</tt>.
  You may need to set the <tt>$HOME</tt> environment variable in the data
  directory.
{% endblocktrans %}
 </p>
{%  endif %}
{% endif %}

{# This should handle the empty $HOME and non-standard name cases from above. #}
{% if expected_data_dir != data_dir %}
 <h3>{% trans "Configuring $HOME" %}</h3>
 <p>
{% blocktrans %}
  If you're using mod_python and Apache, you may need to add this line
  to your Apache configuration:
{% endblocktrans %}
 </p>
<pre>
    SetEnv HOME "{{expected_data_dir}}"
</pre>
 <p>
{% blocktrans %}
  If using fastcgi or wsgi, you want to check the <tt>reviewboard.fcgi</tt> or
  <tt>reviewboard.wsgi</tt> file in your site's <tt>htdocs</tt> directory
  and add the following if missing:
{% endblocktrans %}
 </p>
<pre>
    os.environ['HOME'] = '{{expected_data_dir}}'
</pre>
<p>
{% blocktrans %}
  If you're running this on Windows, you need to add the 'HOME' variable
  to your environment variables. Set <strong>HOME</strong> to:
{% endblocktrans %}
</p>
<pre>
    '{{expected_data_dir}}'
</pre>
{% endif %}

{% if not writable and data_dir != "" %}
 <h3>{% trans "Permission problems" %}</h3>
 <p>
{% blocktrans %}
  The data directory must be writable by the web server. On Linux/Unix/Mac,
  you can fix this by typing:
{% endblocktrans %}
 </p>
<pre>
    $ sudo chown -R {{server_user}} "{{expected_data_dir}}"
</pre>
 <p>
{% blocktrans %}
  On Windows, right-click the data directory and change the ownership to
  <tt>{{server_user}}</tt> and restart the server.
{% endblocktrans %}
 </p>
{% endif %}
</div>
