blue-twilight/resources/views/themes/base/admin/settings.blade.php

550 lines
38 KiB
PHP

@extends(Theme::viewName('layout'))
@section('title', trans('admin.settings_title'))
@section('breadcrumb')
<li class="breadcrumb-item"><a href="{{ route('home') }}"><i class="fa fa-fw fa-home"></i></a></li>
<li class="breadcrumb-item"><a href="{{ route('admin') }}">@lang('navigation.breadcrumb.admin')</a></li>
<li class="breadcrumb-item active">@lang('navigation.breadcrumb.settings')</li>
@endsection
@section('content')
<div class="container">
<div class="row">
<div class="col" id="settings-app">
<h1>@yield('title')</h1>
<p style="margin-bottom: 30px;">@lang('admin.settings_intro')</p>
<form action="{{ route('admin.saveSettings') }}" method="post">
{{ csrf_field() }}
<div>
{{-- Nav tabs --}}
<ul class="nav nav-tabs" role="tablist">
@include(Theme::viewName('partials.tab'), ['active_tab' => 'general', 'tab_name' => 'general', 'tab_icon' => 'info-circle', 'tab_text' => trans('admin.settings_general_tab')])
@include(Theme::viewName('partials.tab'), ['active_tab' => 'general', 'tab_name' => 'email', 'tab_icon' => 'envelope', 'tab_text' => trans('admin.settings_email_tab')])
@include(Theme::viewName('partials.tab'), ['active_tab' => 'general', 'tab_name' => 'security', 'tab_icon' => 'lock', 'tab_text' => trans('admin.settings_security_tab')])
@include(Theme::viewName('partials.tab'), ['active_tab' => 'general', 'tab_name' => 'analytics', 'tab_icon' => 'line-chart', 'tab_text' => trans('admin.settings.analytics_tab')])
@include(Theme::viewName('partials.tab'), ['active_tab' => 'general', 'tab_name' => 'social', 'tab_icon' => 'users', 'tab_text' => trans('admin.settings.social_tab')])
</ul>
{{-- Tab panes --}}
<div class="tab-content">
{{-- General --}}
<div role="tabpanel" class="tab-pane active" id="general-tab">
<div class="form-group">
<label class="form-control-label" for="gallery-name">Gallery name:</label>
<input type="text" class="form-control{{ $errors->has('app_name') ? ' is-invalid' : '' }}" id="gallery-name" name="app_name" value="{{ old('app_name', $config['app_name']) }}">
@if ($errors->has('app_name'))
<div class="invalid-feedback">
<strong>{{ $errors->first('app_name') }}</strong>
</div>
@endif
</div>
<div class="row">
<div class="col-sm-4">
<div class="form-group">
<label class="form-control-label" for="date-format">Date format:</label>
<select name="date_format" id="date-format" class="form-control">
@foreach ($date_formats as $key => $value)
<option value="{{ $key }}"{{ old('date_format', $config['date_format']) == $key ? ' selected="selected"' : '' }}>{{ $value }}</option>
@endforeach
</select>
@if ($errors->has('date_format'))
<div class="invalid-feedback">
<strong>{{ $errors->first('date_format') }}</strong>
</div>
@endif
</div>
</div>
</div>
<div class="row">
<div class="col-sm-4">
<div class="form-group">
<label class="form-control-label" for="theme">Theme:</label>
<select name="theme" id="theme" class="form-control">
@foreach ($theme_names as $key => $value)
<option value="{{ $key }}"{{ old('theme', $config['theme']) == $key ? ' selected="selected"' : '' }}>{{ $value }}</option>
@endforeach
</select>
@if ($errors->has('theme'))
<div class="invalid-feedback">
<strong>{{ $errors->first('theme') }}</strong>
</div>
@endif
</div>
</div>
</div>
<hr/>
<fieldset>
<legend>@lang('admin.settings.albums_menu_heading')</legend>
<div class="form-check mb-3">
<input type="checkbox" class="form-check-input" id="albums-menu-parents-only" name="albums_menu_parents_only" @if (old('albums_menu_parents_only', UserConfig::get('albums_menu_parents_only')))checked="checked"@endif>
<label class="form-check-label" for="albums-menu-parents-only">
<strong>@lang('admin.settings.albums_menu_parents_only')</strong>
</label>
</div>
<div class="form-group">
<label class="form-control-label" for="albums-menu-number-items">@lang('admin.settings.albums_menu_number_items')</label>
<input type="number" class="form-control{{ $errors->has('albums_menu_number_items') ? ' is-invalid' : '' }}" id="albums-menu-number-items" name="albums_menu_number_items" value="{{ old('albums_menu_number_items', $config['albums_menu_number_items']) }}" style="max-width: 100px;">
@if ($errors->has('albums_menu_number_items'))
<div class="invalid-feedback">
<strong>{{ $errors->first('albums_menu_number_items') }}</strong>
</div>
@endif
</div>
</fieldset>
<hr/>
<fieldset>
<legend>&quot;Powered by&quot; footer link</legend>
<p>To help spread the word about Blue Twilight, I'd really appreciate it if you left the &quot;Powered by&quot; notice in your gallery's footer.</p>
<p>If you do want to remove it, however, I understand - just check the box below.</p>
<div class="form-check mt-2">
<input type="checkbox" class="form-check-input" id="remove-copyright" name="remove_copyright" @if (old('remove_copyright', UserConfig::get('remove_copyright')))checked="checked"@endif>
<label class="form-check-label" for="remove-copyright">
<strong>Remove &quot;Powered by&quot; notice from the public gallery</strong>
</label>
</div>
</fieldset>
</div>
{{-- E-mail --}}
<div role="tabpanel" class="tab-pane" id="email-tab">
<div class="form-group">
<label class="form-control-label" for="email-sender-name">Sender name:</label>
<input type="text" class="form-control{{ $errors->has('sender_name') ? ' is-invalid' : '' }}" id="email-sender-name" name="sender_name" value="{{ old('sender_name', $config['sender_name']) }}">
@if ($errors->has('sender_name'))
<div class="invalid-feedback">
<strong>{{ $errors->first('sender_name') }}</strong>
</div>
@endif
</div>
<div class="form-group">
<label class="form-control-label" for="email-sender-address">Sender address:</label>
<input type="text" class="form-control{{ $errors->has('sender_address') ? ' is-invalid' : '' }}" id="email-sender-address" name="sender_address" value="{{ old('sender_address', $config['sender_address']) }}">
@if ($errors->has('sender_address'))
<div class="invalid-feedback">
<strong>{{ $errors->first('sender_address') }}</strong>
</div>
@endif
</div>
<fieldset style="margin-top: 20px;">
<legend>SMTP Server</legend>
<p style="margin-bottom: 15px;">Configure your SMTP server using the settings below. If your server does not require authentication, leave the Username and Password fields empty.</p>
<div class="form-group">
<label class="form-control-label" for="email-smtp-server">Hostname:</label>
<input type="text" class="form-control{{ $errors->has('smtp_server') ? ' is-invalid' : '' }}" id="email-smtp-server" name="smtp_server" value="{{ old('smtp_server', $config['smtp_server']) }}">
@if ($errors->has('smtp_server'))
<div class="invalid-feedback">
<strong>{{ $errors->first('smtp_server') }}</strong>
</div>
@endif
</div>
<div class="form-group">
<label class="form-control-label" for="email-smtp-port">Port:</label>
<input type="text" class="form-control{{ $errors->has('smtp_port') ? ' is-invalid' : '' }}" id="email-smtp-port" name="smtp_port" value="{{ old('smtp_port', $config['smtp_port']) }}">
@if ($errors->has('smtp_port'))
<div class="invalid-feedback">
<strong>{{ $errors->first('smtp_port') }}</strong>
</div>
@endif
</div>
<div class="form-group">
<label class="form-control-label" for="email-smtp-username">Username:</label>
<input type="text" class="form-control{{ $errors->has('smtp_username') ? ' is-invalid' : '' }}" id="email-smtp-username" name="smtp_username" value="{{ old('smtp_username', $config['smtp_username']) }}">
@if ($errors->has('smtp_username'))
<div class="invalid-feedback">
<strong>{{ $errors->first('smtp_username') }}</strong>
</div>
@endif
</div>
<div class="form-group">
<label class="form-control-label" for="email-smtp-password">Password:</label>
<input type="text" class="form-control{{ $errors->has('smtp_password') ? ' is-invalid' : '' }}" id="email-smtp-password" name="smtp_password" value="{{ old('smtp_password', $config['smtp_password']) }}">
@if ($errors->has('smtp_password'))
<div class="invalid-feedback">
<strong>{{ $errors->first('smtp_password') }}</strong>
</div>
@endif
</div>
<div class="form-check">
<input type="checkbox" class="form-check-input" id="smtp-encryption" name="smtp_encryption" @if (UserConfig::get('smtp_encryption'))checked="checked"@endif>
<label class="form-check-label" for="smtp-encryption">
<strong>Requires encrypted connection</strong>
</label>
</div>
<div style="margin-top: 20px;">
<button id="test-email-button" type="button" class="btn btn-primary">@lang('admin.settings_test_email_action')</button>
<div style="margin-top: 10px;">
<div class="alert alert-info" id="test-email-status" style="display: none;">
<img src="{{ asset('ripple.svg') }}"/> Testing e-mail settings...
</div>
<div class="alert" id="test-email-result" style="display: none;">
<i class="fa fa-fw fa-info-circle"></i>
<strong id="test-email-result-summary"></strong> <span id="test-email-result-message"></span>
</div>
</div>
</div>
</fieldset>
</div>
{{-- Security --}}
<div role="tabpanel" class="tab-pane" id="security-tab">
<div class="form-check">
<input type="checkbox" class="form-check-input" id="allow-self-registration" name="allow_self_registration" @if (old('allow_self_registration', UserConfig::get('allow_self_registration')))checked="checked"@endif>
<label class="form-check-label" for="allow-self-registration">
<span class="custom-control-description"><strong>@lang('admin.settings.security_allow_self_registration')</strong><br/>
@lang('admin.settings.security_allow_self_registration_description')</span>
</label>
</div>
<div class="form-check mt-3">
<input type="checkbox" class="form-check-input" id="require-email-verification" name="require_email_verification" @if (old('require_email_verification', UserConfig::get('require_email_verification')))checked="checked"@endif>
<label class="form-check-label" for="require-email-verification">
<strong>Require e-mail verification for self-registered accounts</strong><br/>
<span class="text-danger">It is strongly recommended to enable this option.</span>
</label>
</div>
<div class="form-check mt-3">
<input type="checkbox" class="form-check-input" id="recaptcha-enabled-registration" name="recaptcha_enabled_registration" @if (old('recaptcha_enabled_registration', UserConfig::get('recaptcha_enabled_registration')))checked="checked"@endif>
<label class="form-check-label" for="recaptcha-enabled-registration">
<strong>Enable <a href="https://www.google.com/recaptcha" target="_blank">reCAPTCHA</a> for self-registrations</strong><br/>
<span class="text-danger">It is strongly recommended to enable this option.</span>
</label>
</div>
<hr/>
<fieldset>
<legend>@lang('admin.settings_recaptcha')</legend>
<div class="form-group">
<label class="form-control-label" for="recaptcha-site-key">Site key:</label>
<input type="text" class="form-control{{ $errors->has('recaptcha_site_key') ? ' is-invalid' : '' }}" id="recaptcha-site-key" name="recaptcha_site_key" value="{{ old('recaptcha_site_key', $config['recaptcha_site_key']) }}">
@if ($errors->has('recaptcha_site_key'))
<div class="invalid-feedback">
<strong>{{ $errors->first('recaptcha_site_key') }}</strong>
</div>
@endif
</div>
<div class="form-group">
<label class="form-control-label" for="recaptcha-secret-key">Secret key:</label>
<input type="text" class="form-control{{ $errors->has('recaptcha_secret_key') ? ' is-invalid' : '' }}" id="recaptcha-secret-key" name="recaptcha_secret_key" value="{{ old('recaptcha_secret_key', $config['recaptcha_secret_key']) }}">
@if ($errors->has('recaptcha_secret_key'))
<div class="invalid-feedback">
<strong>{{ $errors->first('recaptcha_secret_key') }}</strong>
</div>
@endif
</div>
</fieldset>
<hr/>
<fieldset>
<legend>@lang('admin.settings_image_protection')</legend>
<div class="form-check">
<input type="checkbox" class="form-check-input" id="restrict-original-download" name="restrict_original_download" @if (old('restrict_original_download', UserConfig::get('restrict_original_download')))checked="checked"@endif>
<label class="form-check-label" for="restrict-original-download">
<strong>@lang('forms.settings_restrict_originals_download')</strong><br/>
@lang('forms.settings_restrict_originals_download_help')
</label>
</div>
<div class="form-check mt-3">
<input type="checkbox" class="form-check-input" id="hotlink-protection" name="hotlink_protection" @if (old('hotlink_protection', UserConfig::get('hotlink_protection')))checked="checked"@endif>
<label class="form-check-label" for="hotlink-protection">
<span class="custom-control-description"><strong>@lang('forms.settings_hotlink_protection')</strong><br/>
@lang('forms.settings_hotlink_protection_help')</span>
</label>
</div>
</fieldset>
<hr/>
<fieldset>
<legend>@lang('admin.settings.permissions_cache')</legend>
<p>@lang('admin.settings.permissions_cache_intro')</p>
<button class="btn btn-primary" v-on:click="rebuildPermissionsCache">@lang('admin.settings.rebuild_permissions_cache')</button>
</fieldset>
</div>
{{-- Analytics --}}
<div role="tabpanel" class="tab-pane" id="analytics-tab">
<div class="alert alert-warning">
<p>@lang('admin.settings.analytics_cookie_warning_1')</p>
<p>@lang('admin.settings.analytics_cookie_warning_2')</p>
<p class="mb-0">
<a href="https://www.cookielaw.org/the-cookie-law/" target="_blank">@lang('admin.settings.analytics_cookie_link_1')</a><br/>
<a href="https://cookieconsent.insites.com/" target="_blank">@lang('admin.settings.analytics_cookie_link_2')</a>
</p>
</div>
<div class="form-check mt-4">
<input type="checkbox" class="form-check-input" id="enable-visitor-hits" name="enable_visitor_hits" @if (old('enable_visitor_hits', UserConfig::get('enable_visitor_hits')))checked="checked"@endif>
<label class="form-check-label" for="enable-visitor-hits">
<strong>@lang('admin.settings.analytics_enable_visitor_hits')</strong><br/>
@lang('admin.settings.analytics_enable_visitor_hits_description')
</label>
</div>
<hr/>
<fieldset>
<legend>@lang('admin.visitor_analytics_heading')</legend>
<p>@lang('admin.visitor_analytics_p')</p>
<p>@lang('admin.visitor_analytics_p2')</p>
<textarea class="form-control" rows="10" name="analytics_code">{{ old('analytics_code', $config['analytics_code']) }}</textarea>
</fieldset>
</div>
{{-- Social --}}
<div role="tabpanel" class="tab-pane" id="social-tab">
<div class="form-check">
<input type="checkbox" class="form-check-input" id="allow-photo-comments" name="allow_photo_comments" @if (old('allow_photo_comments', UserConfig::get('allow_photo_comments')))checked="checked"@endif>
<label class="form-check-label" for="allow-photo-comments">
<strong>@lang('forms.settings_allow_photo_comments')</strong><br/>
@lang('forms.settings_allow_photo_comments_help')
</label>
</div>
<div class="form-check mt-3">
<input type="checkbox" class="form-check-input" id="photo-comments-require-login" name="photo_comments_require_login" @if (old('photo_comments_require_login', UserConfig::get('photo_comments_require_login')))checked="checked"@endif>
<label class="form-check-label" for="photo-comments-require-login">
<strong>@lang('forms.settings_photo_comments_require_login')</strong><br/>
@lang('forms.settings_photo_comments_require_login_help')
</label>
</div>
<div class="form-check mt-3">
<input type="checkbox" class="form-check-input" id="social-user-profiles" name="social_user_profiles" @if (old('social_user_profiles', UserConfig::get('social_user_profiles')))checked="checked"@endif>
<label class="form-check-label" for="social-user-profiles">
<strong>@lang('forms.settings_social_user_profiles')</strong><br/>
@lang('forms.settings_social_user_profiles_help')
</label>
</div>
<hr class="mt-4 mb-4"/>
{{-- Facebook --}}
<div class="row">
<div class="col-2 col-sm-1">
<i class="fa fa-facebook fa-fw" style="font-size: xx-large;"></i>
</div>
<div class="col-10 col-sm-11">
<fieldset>
<legend class="mb-3">
@lang('admin.settings.social_facebook')
</legend>
<div class="form-check">
<input type="checkbox" class="form-check-input" id="social-facebook-login" name="social_facebook_login" @if (old('social_facebook_login', $config['social_facebook_login']))checked="checked"@endif>
<label class="form-check-label" for="social-facebook-login">
<strong>@lang('forms.settings_social_facebook_login')</strong><br/>
@lang('forms.settings_social_facebook_login_help')
</label>
</div>
<div class="form-group mt-3">
<label class="form-control-label" for="facebook-app-id">@lang('forms.settings_social_facebook_app_id')</label>
<input type="text" class="form-control{{ $errors->has('facebook_app_id') ? ' is-invalid' : '' }}" id="facebook-app-id" name="facebook_app_id" value="{{ old('facebook_app_id', $config['facebook_app_id']) }}">
@if ($errors->has('facebook_app_id'))
<div class="invalid-feedback">
<strong>{{ $errors->first('facebook_app_id') }}</strong>
</div>
@endif
</div>
<div class="form-group mt-3">
<label class="form-control-label" for="facebook-app-secret">@lang('forms.settings_social_facebook_app_secret')</label>
<input type="text" class="form-control{{ $errors->has('facebook_app_secret') ? ' is-invalid' : '' }}" id="facebook-app-secret" name="facebook_app_secret" value="{{ old('facebook_app_secret', $config['facebook_app_secret']) }}">
@if ($errors->has('facebook_app_secret'))
<div class="invalid-feedback">
<strong>{{ $errors->first('facebook_app_secret') }}</strong>
</div>
@endif
</div>
</fieldset>
</div>
</div>
<hr class="mt-4 mb-4"/>
{{-- Twitter --}}
<div class="row">
<div class="col-2 col-sm-1">
<i class="fa fa-twitter fa-fw" style="font-size: xx-large;"></i>
</div>
<div class="col-10 col-sm-11">
<fieldset>
<legend class="mb-3">
@lang('admin.settings.social_twitter')
</legend>
<div class="form-check">
<input type="checkbox" class="form-check-input" id="social-twitter-login" name="social_twitter_login" @if (old('social_twitter_login', $config['social_twitter_login']))checked="checked"@endif>
<label class="form-check-label" for="social-twitter-login">
<strong>@lang('forms.settings_social_twitter_login')</strong><br/>
@lang('forms.settings_social_twitter_login_help')
</label>
</div>
<div class="form-group mt-3">
<label class="form-control-label" for="twitter-app-id">@lang('forms.settings_social_twitter_app_id')</label>
<input type="text" class="form-control{{ $errors->has('twitter_app_id') ? ' is-invalid' : '' }}" id="twitter-app-id" name="twitter_app_id" value="{{ old('twitter_app_id', $config['twitter_app_id']) }}">
@if ($errors->has('twitter_app_id'))
<div class="invalid-feedback">
<strong>{{ $errors->first('twitter_app_id') }}</strong>
</div>
@endif
</div>
<div class="form-group mt-3">
<label class="form-control-label" for="twitter-app-secret">@lang('forms.settings_social_twitter_app_secret')</label>
<input type="text" class="form-control{{ $errors->has('twitter_app_secret') ? ' is-invalid' : '' }}" id="twitter-app-secret" name="twitter_app_secret" value="{{ old('twitter_app_secret', $config['twitter_app_secret']) }}">
@if ($errors->has('twitter_app_secret'))
<div class="invalid-feedback">
<strong>{{ $errors->first('twitter_app_secret') }}</strong>
</div>
@endif
</div>
</fieldset>
</div>
</div>
{{-- Google+ --}}
<div class="row">
<div class="col-2 col-sm-1">
<i class="fa fa-google fa-fw" style="font-size: xx-large;"></i>
</div>
<div class="col-10 col-sm-11">
<fieldset>
<legend class="mb-3">
@lang('admin.settings.social_google')
</legend>
<div class="form-check">
<input type="checkbox" class="form-check-input" id="social-google-login" name="social_google_login" @if (old('social_google_login', $config['social_google_login']))checked="checked"@endif>
<label class="form-check-label" for="social-google-login">
<strong>@lang('forms.settings_social_google_login')</strong><br/>
@lang('forms.settings_social_google_login_help')
</label>
</div>
<div class="form-group mt-3">
<label class="form-control-label" for="google-app-id">@lang('forms.settings_social_google_app_id')</label>
<input type="text" class="form-control{{ $errors->has('google_app_id') ? ' is-invalid' : '' }}" id="google-app-id" name="google_app_id" value="{{ old('google_app_id', $config['google_app_id']) }}">
@if ($errors->has('google_app_id'))
<div class="invalid-feedback">
<strong>{{ $errors->first('google_app_id') }}</strong>
</div>
@endif
</div>
<div class="form-group mt-3">
<label class="form-control-label" for="google-app-secret">@lang('forms.settings_social_google_app_secret')</label>
<input type="text" class="form-control{{ $errors->has('google_app_secret') ? ' is-invalid' : '' }}" id="google-app-secret" name="google_app_secret" value="{{ old('google_app_secret', $config['google_app_secret']) }}">
@if ($errors->has('google_app_secret'))
<div class="invalid-feedback">
<strong>{{ $errors->first('google_app_secret') }}</strong>
</div>
@endif
</div>
</fieldset>
</div>
</div>
</div>
</div>
<div class="pull-right" style="margin-top: 15px;">
<a href="{{ route('admin') }}" class="btn btn-link">@lang('forms.cancel_action')</a>
<button type="submit" class="btn btn-success"><i class="fa fa-fw fa-check"></i> @lang('admin.settings_save_action')</button>
</div>
</div>
</form>
</div>
</div>
</div>
@endsection
@push('scripts')
<script type="text/javascript">
var viewModel = new SettingsViewModel(
{
'rebuild_permissions_cache': '{{ route('admin.rebuildPermissionsCache') }}'
},
{
'permissions_cache_rebuild_failed': '@lang('admin.settings.rebuild_permissions_cache_failed')',
'permissions_cache_rebuild_succeeded': '@lang('admin.settings.rebuild_permissions_cache_succeeded')'
}
);
$(document).ready(function() {
var app = new Vue(viewModel);
$('#test-email-button').click(function() {
var data = $('form').serialize();
$('#test-email-status').show();
$.post('{{ route('admin.testMailSettings') }}', data, function(data)
{
$('#test-email-result').removeClass('alert-danger');
$('#test-email-result').removeClass('alert-success');
if (data.is_successful)
{
$('#test-email-result').addClass('alert-success');
$('#test-email-result-summary').html('@lang('admin.settings_test_email_summary_successful')');
}
else
{
$('#test-email-result').addClass('alert-danger');
$('#test-email-result-summary').html('@lang('admin.settings_test_email_summary_failed')');
}
$('#test-email-result-message').html(data.message);
$('#test-email-result').show();
$('#test-email-status').hide();
});
return false;
});
});
</script>
@endpush