mirror of
https://github.com/freescout-helpdesk/freescout.git
synced 2024-11-24 11:22:42 +01:00
Mailbox incoming settings
This commit is contained in:
parent
0cc9e6b57d
commit
b1203c4837
@ -157,7 +157,7 @@ class MailboxesController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Mailbox permissions
|
||||
* Mailbox connection settings
|
||||
*/
|
||||
public function connectionOutgoing($id)
|
||||
{
|
||||
@ -166,4 +166,74 @@ class MailboxesController extends Controller
|
||||
|
||||
return view('mailboxes/connection', ['mailbox' => $mailbox, 'sendmail_path' => ini_get('sendmail_path')]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Save mailbox connection settings
|
||||
*/
|
||||
public function connectionOutgoingSave($id, Request $request)
|
||||
{
|
||||
$mailbox = Mailbox::findOrFail($id);
|
||||
$this->authorize('update', $mailbox);
|
||||
|
||||
if ($request->out_method == Mailbox::OUT_METHOD_SMTP) {
|
||||
$validator = Validator::make($request->all(), [
|
||||
'out_server' => 'required|string|max:255',
|
||||
'out_port' => 'required|integer',
|
||||
'out_username' => 'required|string|max:100',
|
||||
'out_password' => 'required|string|max:255',
|
||||
'out_ssl' => 'required|integer',
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return redirect()->route('mailboxes.connection', ['id' => $id])
|
||||
->withErrors($validator)
|
||||
->withInput();
|
||||
}
|
||||
}
|
||||
|
||||
$mailbox->fill($request->all());
|
||||
$mailbox->save();
|
||||
|
||||
\Session::flash('flash_success', __('Connection settings saved!'));
|
||||
return redirect()->route('mailboxes.connection', ['id' => $id]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Mailbox incoming settings
|
||||
*/
|
||||
public function connectionIncoming($id)
|
||||
{
|
||||
$mailbox = Mailbox::findOrFail($id);
|
||||
$this->authorize('update', $mailbox);
|
||||
|
||||
return view('mailboxes/connection_incoming', ['mailbox' => $mailbox]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Save mailbox connection settings
|
||||
*/
|
||||
public function connectionIncomingSave($id, Request $request)
|
||||
{
|
||||
$mailbox = Mailbox::findOrFail($id);
|
||||
$this->authorize('update', $mailbox);
|
||||
|
||||
$validator = Validator::make($request->all(), [
|
||||
'in_server' => 'required|string|max:255',
|
||||
'in_port' => 'required|integer',
|
||||
'in_username' => 'required|string|max:100',
|
||||
'in_password' => 'required|string|max:255',
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return redirect()->route('mailboxes.connection.incoming', ['id' => $id])
|
||||
->withErrors($validator)
|
||||
->withInput();
|
||||
}
|
||||
|
||||
$mailbox->fill($request->all());
|
||||
$mailbox->save();
|
||||
|
||||
\Session::flash('flash_success', __('Connection settings saved!'));
|
||||
return redirect()->route('mailboxes.connection.incoming', ['id' => $id]);
|
||||
}
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ class Mailbox extends Model
|
||||
* Attributes fillable using fill() method
|
||||
* @var [type]
|
||||
*/
|
||||
protected $fillable = ['name', 'slug', 'email', 'aliases', 'from_name', 'from_name_custom', 'ticket_status', 'ticket_assignee', 'template', 'signature', 'out_method', 'out_server', 'out_username', 'out_port', 'out_ssl', 'auto_reply_enabled', 'auto_reply_subject', 'auto_reply_message', 'office_hours_enabled', 'ratings', 'ratings_placement', 'ratings_text'];
|
||||
protected $fillable = ['name', 'slug', 'email', 'aliases', 'from_name', 'from_name_custom', 'ticket_status', 'ticket_assignee', 'template', 'signature', 'out_method', 'out_server', 'out_username', 'out_password', 'out_port', 'out_ssl', 'in_server', 'in_port', 'in_username', 'in_password', 'auto_reply_enabled', 'auto_reply_subject', 'auto_reply_message', 'office_hours_enabled', 'ratings', 'ratings_placement', 'ratings_text'];
|
||||
|
||||
protected static function boot()
|
||||
{
|
||||
|
1
public/css/style.css
vendored
1
public/css/style.css
vendored
@ -539,6 +539,7 @@ a h4 {
|
||||
position: relative;
|
||||
padding-left: 5px;
|
||||
top: -2px;
|
||||
font-style: normal;
|
||||
}
|
||||
.accordion .panel-default > .panel-heading {
|
||||
background-color: #fff;
|
||||
|
9
public/js/main.js
vendored
9
public/js/main.js
vendored
@ -64,8 +64,15 @@ function mailboxConnectionInit(out_method_smtp)
|
||||
{
|
||||
$(document).ready(function(){
|
||||
$(':input[name="out_method"]').on('change', function(event) {
|
||||
var method = $(':input[name="out_method"]:checked').val();
|
||||
$('.out_method_options').addClass('hidden');
|
||||
$('#out_method_'+$(':input[name="out_method"]:checked').val()+'_options').removeClass('hidden');
|
||||
$('#out_method_'+method+'_options').removeClass('hidden');
|
||||
|
||||
if (parseInt(method) == parseInt(out_method_smtp)) {
|
||||
$('#out_method_'+out_method_smtp+'_options :input').attr('required', 'required');
|
||||
} else {
|
||||
$('#out_method_'+out_method_smtp+'_options :input').removeAttr('required');
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
@ -48,12 +48,12 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="out_method_{{ App\Mailbox::OUT_METHOD_SMTP }}_options" class="out_method_options hidden margin-top">
|
||||
<div id="out_method_{{ App\Mailbox::OUT_METHOD_SMTP }}_options" class="out_method_options @if ($mailbox->out_method != App\Mailbox::OUT_METHOD_SMTP) hidden @endif margin-top">
|
||||
<div class="form-group{{ $errors->has('out_server') ? ' has-error' : '' }}">
|
||||
<label for="out_server" class="col-sm-2 control-label">{{ __('SMTP Server') }}</label>
|
||||
|
||||
<div class="col-md-6">
|
||||
<input id="out_server" type="text" class="form-control input-sized" name="out_server" value="{{ old('out_server', $mailbox->out_server) }}" maxlength="255" required autofocus>
|
||||
<input id="out_server" type="text" class="form-control input-sized" name="out_server" value="{{ old('out_server', $mailbox->out_server) }}" maxlength="255" @if ($mailbox->out_method == App\Mailbox::OUT_METHOD_SMTP) required @endif autofocus>
|
||||
|
||||
@include('partials/field_error', ['field'=>'out_server'])
|
||||
</div>
|
||||
@ -62,7 +62,7 @@
|
||||
<label for="out_port" class="col-sm-2 control-label">{{ __('Port') }}</label>
|
||||
|
||||
<div class="col-md-6">
|
||||
<input id="out_port" type="number" class="form-control input-sized" name="out_port" value="{{ old('out_port', $mailbox->out_port) }}" maxlength="5" required autofocus>
|
||||
<input id="out_port" type="number" class="form-control input-sized" name="out_port" value="{{ old('out_port', $mailbox->out_port) }}" maxlength="5" @if ($mailbox->out_method == App\Mailbox::OUT_METHOD_SMTP) required @endif autofocus>
|
||||
|
||||
@include('partials/field_error', ['field'=>'out_port'])
|
||||
</div>
|
||||
@ -71,7 +71,7 @@
|
||||
<label for="out_username" class="col-sm-2 control-label">{{ __('Username') }}</label>
|
||||
|
||||
<div class="col-md-6">
|
||||
<input id="out_username" type="text" class="form-control input-sized" name="out_username" value="{{ old('out_username', $mailbox->out_username) }}" maxlength="100" required autofocus>
|
||||
<input id="out_username" type="text" class="form-control input-sized" name="out_username" value="{{ old('out_username', $mailbox->out_username) }}" maxlength="100" @if ($mailbox->out_method == App\Mailbox::OUT_METHOD_SMTP) required @endif autofocus>
|
||||
|
||||
@include('partials/field_error', ['field'=>'out_username'])
|
||||
</div>
|
||||
@ -80,7 +80,7 @@
|
||||
<label for="out_password" class="col-sm-2 control-label">{{ __('Password') }}</label>
|
||||
|
||||
<div class="col-md-6">
|
||||
<input id="out_password" type="password" class="form-control input-sized" name="out_password" value="{{ old('out_password', $mailbox->out_password) }}" maxlength="255" required autofocus>
|
||||
<input id="out_password" type="password" class="form-control input-sized" name="out_password" value="{{ old('out_password', $mailbox->out_password) }}" maxlength="255" @if ($mailbox->out_method == App\Mailbox::OUT_METHOD_SMTP) required @endif autofocus>
|
||||
|
||||
@include('partials/field_error', ['field'=>'out_password'])
|
||||
</div>
|
||||
@ -89,7 +89,7 @@
|
||||
<label for="out_ssl" class="col-sm-2 control-label">{{ __('Security') }}</label>
|
||||
|
||||
<div class="col-md-6">
|
||||
<select id="out_ssl" class="form-control input-sized" name="out_ssl" required autofocus>
|
||||
<select id="out_ssl" class="form-control input-sized" name="out_ssl" @if ($mailbox->out_method == App\Mailbox::OUT_METHOD_SMTP) required @endif autofocus>
|
||||
<option value="{{ App\Mailbox::OUT_SSL_NONE }}" @if (old('out_ssl', $mailbox->out_ssl) == App\Mailbox::OUT_SSL_NONE)selected="selected"@endif>{{ __('None') }}</option>
|
||||
<option value="{{ App\Mailbox::OUT_SSL_SSL }}" @if (old('out_ssl', $mailbox->out_ssl) == App\Mailbox::OUT_SSL_SSL)selected="selected"@endif>{{ __('SSL') }}</option>
|
||||
<option value="{{ App\Mailbox::OUT_SSL_TLS }}" @if (old('out_ssl', $mailbox->out_ssl) == App\Mailbox::OUT_SSL_TLS)selected="selected"@endif>{{ __('TLS') }}</option>
|
||||
|
104
resources/views/mailboxes/connection_incoming.blade.php
Normal file
104
resources/views/mailboxes/connection_incoming.blade.php
Normal file
@ -0,0 +1,104 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('title_full', __('Connection Settings').' - '.$mailbox->name)
|
||||
|
||||
@section('sidebar')
|
||||
@include('partials/sidebar_menu_toggle')
|
||||
@include('mailboxes/sidebar_menu')
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
|
||||
<div class="section-heading-noborder">
|
||||
{{ __('Connection Settings') }}
|
||||
</div>
|
||||
|
||||
@include('mailboxes/connection_menu')
|
||||
|
||||
@include('partials/flash_messages')
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<form class="form-horizontal" method="POST" action="">
|
||||
{{ csrf_field() }}
|
||||
|
||||
<div class="form-group margin-top">
|
||||
<label for="email" class="col-sm-2 control-label">{{ __('Fetch Emails From') }}</label>
|
||||
|
||||
<div class="col-md-6 flexy">
|
||||
<input id="email" type="email" class="form-control input-sized" name="email" value="{{ $mailbox->email }}" disabled="disabled">
|
||||
<a href="{{ route('mailboxes.update', ['id'=>$mailbox->id]) }}#email" class="btn btn-link btn-sm" data-toggle="tooltip" title="{{ __('Change address in mailbox settings') }}">{{ __('Change') }}</a>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-offset-2 col-md-6">
|
||||
<p class="help-block margin-bottom-0"><strong>{{ __('ATTENTION') }}:</strong> {{ __('All emails from this address will be deleted') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group{{ $errors->has('in_server') ? ' has-error' : '' }}">
|
||||
<label for="in_server" class="col-sm-2 control-label">{{ __('POP Server') }}</label>
|
||||
|
||||
<div class="col-md-6">
|
||||
<input id="in_server" type="text" class="form-control input-sized" name="in_server" value="{{ old('in_server', $mailbox->in_server) }}" maxlength="255" required autofocus>
|
||||
|
||||
@include('partials/field_error', ['field'=>'in_server'])
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group{{ $errors->has('in_port') ? ' has-error' : '' }}">
|
||||
<label for="in_port" class="col-sm-2 control-label">{{ __('Port') }}</label>
|
||||
|
||||
<div class="col-md-6">
|
||||
<input id="in_port" type="number" class="form-control input-sized" name="in_port" value="{{ old('in_port', $mailbox->in_port) }}" maxlength="5" required autofocus>
|
||||
|
||||
@include('partials/field_error', ['field'=>'in_port'])
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group{{ $errors->has('in_username') ? ' has-error' : '' }}">
|
||||
<label for="in_username" class="col-sm-2 control-label">{{ __('Username') }}</label>
|
||||
|
||||
<div class="col-md-6">
|
||||
<input id="in_username" type="text" class="form-control input-sized" name="in_username" value="{{ old('in_username', $mailbox->in_username) }}" maxlength="100" required autofocus>
|
||||
|
||||
@include('partials/field_error', ['field'=>'in_username'])
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group{{ $errors->has('in_password') ? ' has-error' : '' }}">
|
||||
<label for="in_password" class="col-sm-2 control-label">{{ __('Password') }}</label>
|
||||
|
||||
<div class="col-md-6">
|
||||
<input id="in_password" type="password" class="form-control input-sized" name="in_password" value="{{ old('in_password', $mailbox->in_password) }}" maxlength="255" required autofocus>
|
||||
|
||||
@include('partials/field_error', ['field'=>'in_password'])
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group margin-top">
|
||||
<div class="col-md-6 col-sm-offset-2">
|
||||
<button type="button" class="btn btn-default btn-sm">
|
||||
{{ __('Check Connection') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group margin-top-2">
|
||||
<div class="col-md-6 col-sm-offset-2">
|
||||
<button type="submit" class="btn btn-primary">
|
||||
{{ __('Save Settings') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="margin-top-2"></div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('javascript')
|
||||
@parent
|
||||
mailboxConnectionInit('{{ App\Mailbox::OUT_METHOD_SMTP }}');
|
||||
@endsection
|
@ -12,7 +12,7 @@
|
||||
</div>
|
||||
<ul class="sidebar-menu">
|
||||
<li @if (Route::currentRouteName() == 'mailboxes.update')class="active"@endif><a href="{{ route('mailboxes.update', ['id'=>$mailbox->id]) }}"><i class="glyphicon glyphicon-envelope"></i> {{ __('Edit Mailbox') }}</a></li>
|
||||
<li @if (Route::currentRouteName() == 'mailboxes.connection')class="active"@endif><a href="{{ route('mailboxes.connection', ['id'=>$mailbox->id]) }}"><i class="glyphicon glyphicon-cog"></i> {{ __('Connection Settings') }}</a></li>
|
||||
<li @if (Route::currentRouteName() == 'mailboxes.connection' || Route::currentRouteName() == 'mailboxes.connection.incoming')class="active"@endif><a href="{{ route('mailboxes.connection', ['id'=>$mailbox->id]) }}"><i class="glyphicon glyphicon-cog"></i> {{ __('Connection Settings') }}</a></li>
|
||||
<li @if (Route::currentRouteName() == 'mailboxes.permissions')class="active"@endif><a href="{{ route('mailboxes.permissions', ['id'=>$mailbox->id]) }}"><i class="glyphicon glyphicon-ok"></i> {{ __('Permissions') }}</a></li>
|
||||
<li @if (Route::currentRouteName() == 'mailboxes.fields')class="active"@endif><a href="{{ route('mailboxes.update', ['id'=>$mailbox->id]) }}"><i class="glyphicon glyphicon-list"></i> {{ __('Custom Fields') }} (todo)</a></li>
|
||||
<li @if (Route::currentRouteName() == 'mailboxes.autoreply')class="active"@endif><a href="{{ route('mailboxes.update', ['id'=>$mailbox->id]) }}"><i class="glyphicon glyphicon-share"></i> {{ __('Auto Reply') }} (todo)</a></li>
|
||||
|
@ -31,4 +31,6 @@ Route::get('/settings/permissions/{id}', 'MailboxesController@permissions')->nam
|
||||
Route::post('/settings/permissions/{id}', 'MailboxesController@permissionsSave');
|
||||
Route::get('/mailbox/{id}', 'MailboxesController@update')->name('mailboxes.view');
|
||||
Route::get('/settings/connection-settings/{id}/outgoing', 'MailboxesController@connectionOutgoing')->name('mailboxes.connection');
|
||||
Route::get('/settings/connection-settings/{id}/incoming', 'MailboxesController@connectionIncoming')->name('mailboxes.connection.incoming');
|
||||
Route::post('/settings/connection-settings/{id}/outgoing', 'MailboxesController@connectionOutgoingSave');
|
||||
Route::get('/settings/connection-settings/{id}/incoming', 'MailboxesController@connectionIncoming')->name('mailboxes.connection.incoming');
|
||||
Route::post('/settings/connection-settings/{id}/incoming', 'MailboxesController@connectionIncomingSave');
|
Loading…
Reference in New Issue
Block a user