2017-01-22 15:44:37 +00:00
|
|
|
{% extends "layout.html" %}
|
|
|
|
{% block body %}
|
|
|
|
<div class="discover">
|
2017-02-10 19:18:37 +00:00
|
|
|
<h2>{{title}}</h2>
|
2017-01-22 15:44:37 +00:00
|
|
|
<form role="form" method="POST" autocomplete="off">
|
|
|
|
<div class="form-group required">
|
|
|
|
<label for="config_calibre_dir">{{_('Location of Calibre database')}}</label>
|
|
|
|
<input type="text" class="form-control" name="config_calibre_dir" id="config_calibre_dir" value="{% if content.config_calibre_dir != None %}{{ content.config_calibre_dir }}{% endif %}" autocomplete="off">
|
|
|
|
</div>
|
2017-02-20 18:34:37 +00:00
|
|
|
<div class="form-group required">
|
|
|
|
<label for="config_use_google_drive">{{_('Use google drive?')}}</label>
|
|
|
|
<input type="checkbox" id="config_use_google_drive" class="form-control" name="config_use_google_drive" id="config_use_google_drive" {% if content.config_use_google_drive %}checked{% endif %} >
|
|
|
|
</div>
|
|
|
|
<div id="gdrive_settings">
|
|
|
|
<div class="form-group required">
|
|
|
|
<label for="config_google_drive_client_id">{{_('Client id')}}</label>
|
|
|
|
<input type="text" class="form-control" name="config_google_drive_client_id" id="config_google_client_id" value="{% if content.config_google_drive_client_id %}{{content.config_google_drive_client_id}}{% endif %}" autocomplete="off">
|
|
|
|
</div>
|
|
|
|
<div class="form-group required">
|
|
|
|
<label for="config_google_drive_client_secret">{{_('Client secret')}}</label>
|
|
|
|
<input type="text" class="form-control" name="config_google_drive_client_secret" id="config_google_drive_client_secret" value="{% if content.config_google_drive_client_secret %}{{content.config_google_drive_client_secret}}{% endif %}" autocomplete="off">
|
|
|
|
</div>
|
|
|
|
<div class="form-group required">
|
|
|
|
<label for="config_google_drive_calibre_url_base">{{_('Calibre Base URL')}}</label>
|
|
|
|
<input type="text" class="form-control" name="config_google_drive_calibre_url_base" id="config_google_drive_calibre_url_base" value="{% if content.config_google_drive_calibre_url_base %}{{content.config_google_drive_calibre_url_base}}{% endif %}" autocomplete="off">
|
|
|
|
</div>
|
|
|
|
<div class="form-group required">
|
|
|
|
<label for="config_google_drive_folder">{{_('Google drive Calibre folder')}}</label>
|
|
|
|
<input type="text" class="form-control" name="config_google_drive_folder" id="config_google_drive_folder" value="{% if content.config_google_drive_folder %}{{content.config_google_drive_folder}}{% endif %}" autocomplete="off" required>
|
|
|
|
</div>
|
|
|
|
{% if show_authenticate_google_drive %}
|
|
|
|
<div class="form-group required">
|
|
|
|
<a href="{{ url_for('authenticate_google_drive') }}" class="btn btn-primary">Authenticate Google Drive</a>
|
|
|
|
</div>
|
|
|
|
{% else %}
|
|
|
|
{% if content.config_google_drive_watch_changes_response %}
|
|
|
|
<label for="config_google_drive_watch_changes_response">{{_('Metadata Watch Channel ID')}}</label>
|
|
|
|
<div class="form-group input-group required">
|
|
|
|
<input type="text" class="form-control" name="config_google_drive_watch_changes_response" id="config_google_drive_watch_changes_response" value="{{ content.config_google_drive_watch_changes_response['id'] }} expires on {{ content.config_google_drive_watch_changes_response['expiration'] | strftime }}" autocomplete="off" disabled="">
|
|
|
|
<span class="input-group-btn">
|
|
|
|
<a href="{{ url_for('revoke_watch_gdrive') }}" class="btn btn-primary">Revoke</a>
|
|
|
|
</span>
|
|
|
|
{% else %}
|
|
|
|
<a href="{{ url_for('watch_gdrive') }}" class="btn btn-primary">Enable watch of metadata.db</a>
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
2017-01-22 15:44:37 +00:00
|
|
|
<div class="form-group">
|
|
|
|
<label for="config_port">{{_('Server Port')}}</label>
|
2017-01-28 19:16:40 +00:00
|
|
|
<input type="number" min="1" max="65535" class="form-control" name="config_port" id="config_port" value="{% if content.config_port != None %}{{ content.config_port }}{% endif %}" autocomplete="off" required>
|
2017-01-22 15:44:37 +00:00
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<label for="config_calibre_web_title">{{_('Title')}}</label>
|
|
|
|
<input type="text" class="form-control" name="config_calibre_web_title" id="config_calibre_web_title" value="{% if content.config_calibre_web_title != None %}{{ content.config_calibre_web_title }}{% endif %}" autocomplete="off" required>
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<label for="config_books_per_page">{{_('Books per page')}}</label>
|
2017-01-28 19:16:40 +00:00
|
|
|
<input type="number" min="1" max="200" class="form-control" name="config_books_per_page" id="config_books_per_page" value="{% if content.config_books_per_page != None %}{{ content.config_books_per_page }}{% endif %}" autocomplete="off">
|
2017-01-22 15:44:37 +00:00
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<label for="config_random_books">{{_('No. of random books to show')}}</label>
|
2017-01-28 19:16:40 +00:00
|
|
|
<input type="number" min="1" max="30" class="form-control" name="config_random_books" id="config_random_books" value="{% if content.config_random_books != None %}{{ content.config_random_books }}{% endif %}" autocomplete="off">
|
2017-01-22 15:44:37 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="form-group">
|
|
|
|
<label for="config_title_regex">{{_('Regular expression for title sorting')}}</label>
|
|
|
|
<input type="text" class="form-control" name="config_title_regex" id="config_title_regex" value="{% if content.config_title_regex != None %}{{ content.config_title_regex }}{% endif %}" autocomplete="off">
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<label for="config_log_level">{{_('Log Level')}}</label>
|
|
|
|
<select name="config_log_level" id="config_log_level" class="form-control">
|
2017-01-28 19:16:40 +00:00
|
|
|
<option value="10" {% if content.config_log_level == 10 %}selected{% endif %}>DEBUG</option>
|
|
|
|
<option value="20" {% if content.config_log_level == 20 or content.config_log_level == None %}selected{% endif %}>INFO</option>
|
|
|
|
<option value="30" {% if content.config_log_level == 30 %}selected{% endif %}>WARNING</option>
|
|
|
|
<option value="40" {% if content.config_log_level == 40 %}selected{% endif %}>ERROR</option>
|
2017-01-22 15:44:37 +00:00
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<input type="checkbox" id="config_uploading" name="config_uploading" {% if content.config_uploading %}checked{% endif %}>
|
|
|
|
<label for="config_uploading">{{_('Enable uploading')}}</label>
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<input type="checkbox" id="config_anonbrowse" name="config_anonbrowse" {% if content.config_anonbrowse %}checked{% endif %}>
|
|
|
|
<label for="config_anonbrowse">{{_('Enable anonymous browsing')}}</label>
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<input type="checkbox" id="config_public_reg" name="config_public_reg" {% if content.config_public_reg %}checked{% endif %}>
|
|
|
|
<label for="config_public_reg">{{_('Enable public registration')}}</label>
|
2017-01-28 19:16:40 +00:00
|
|
|
</div>
|
2017-02-10 19:18:37 +00:00
|
|
|
<h2>{{_('Default Settings for new users')}}</h2>
|
2017-02-09 05:46:07 +00:00
|
|
|
<div class="form-group">
|
|
|
|
<input type="checkbox" name="admin_role" id="admin_role" {% if content.role_admin() %}checked{% endif %}>
|
|
|
|
<label for="admin_role">{{_('Admin user')}}</label>
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<input type="checkbox" name="download_role" id="download_role" {% if content.role_download() %}checked{% endif %}>
|
|
|
|
<label for="download_role">{{_('Allow Downloads')}}</label>
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<input type="checkbox" name="upload_role" id="upload_role" {% if content.role_upload() %}checked{% endif %}>
|
|
|
|
<label for="upload_role">{{_('Allow Uploads')}}</label>
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<input type="checkbox" name="edit_role" id="edit_role" {% if content.role_edit() %}checked{% endif %}>
|
|
|
|
<label for="edit_role">{{_('Allow Edit')}}</label>
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<input type="checkbox" name="passwd_role" id="passwd_role" {% if content.role_passwd() %}checked{% endif %}>
|
|
|
|
<label for="passwd_role">{{_('Allow Changing Password')}}</label>
|
|
|
|
</div>
|
2017-01-22 15:44:37 +00:00
|
|
|
<button type="submit" class="btn btn-default">{{_('Submit')}}</button>
|
2017-01-28 19:16:40 +00:00
|
|
|
{% if not origin %}
|
|
|
|
<a href="{{ url_for('admin') }}" class="btn btn-default">{{_('Back')}}</a>
|
|
|
|
{% endif %}
|
|
|
|
{% if success %}
|
|
|
|
<a href="{{ url_for('login') }}" class="btn btn-default">{{_('Login')}}</a>
|
|
|
|
{% endif %}
|
2017-01-22 15:44:37 +00:00
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
{% endblock %}
|
2017-02-20 18:34:37 +00:00
|
|
|
{% block js %}
|
|
|
|
<script>
|
|
|
|
$(document).ready(function() {
|
|
|
|
$('#config_use_google_drive').trigger("change");
|
|
|
|
});
|
|
|
|
$('#config_use_google_drive').change(function(){
|
|
|
|
formInputs=$("#gdrive_settings :input");
|
|
|
|
isChecked=this.checked;
|
|
|
|
formInputs.each(function(formInput) {
|
|
|
|
$(this).prop('required',isChecked);
|
|
|
|
});
|
|
|
|
if (this.checked) {
|
|
|
|
$('#gdrive_settings').show();
|
|
|
|
} else {
|
|
|
|
$('#gdrive_settings').hide();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
{% endblock %}
|