Compare commits

..

No commits in common. "e9b578394556fc833bc88c4c0d43d13c3912f38a" and "a65e4b8bc3a3dd71889bd950a8480be3306f1995" have entirely different histories.

36 changed files with 867 additions and 573 deletions

View File

@ -20,13 +20,12 @@ class PageAssets
'datatables' => [
'base' => [
'css' => [
'//cdn.datatables.net/1.10.25/css/dataTables.bootstrap5.css',
'//cdn.datatables.net/2.1.2/css/dataTables.bootstrap4.css',
//'//cdn.datatables.net/2.1.2/css/dataTables.dataTables.min.css',
'/plugin/dataTables/dataTables.bootstrap5.css',
],
'js' => [
'//cdn.datatables.net/1.10.25/js/jquery.dataTables.min.js',
'//cdn.datatables.net/1.10.25/js/dataTables.bootstrap5.min.js',
'//cdn.datatables.net/2.1.2/js/dataTables.min.js',
'//cdn.datatables.net/2.1.2/js/dataTables.bootstrap4.min.js',
],
],
'buttons' => [
@ -43,8 +42,7 @@ class PageAssets
],
'conditionalpaging' => [
'js' => [
//'//cdn.datatables.net/plug-ins/2.0.5/features/conditionalPaging/dataTables.conditionalPaging.min.js',
'/plugin/dataTables/dataTables.conditionalPaging.js',
'//cdn.datatables.net/plug-ins/2.0.5/features/conditionalPaging/dataTables.conditionalPaging.min.js',
],
],
'fixedheader' => [
@ -71,13 +69,13 @@ class PageAssets
],
'rowgroup' => [
'css' => [
'//cdn.datatables.net/rowgroup/1.1.2/css/rowGroup.bootstrap4.min.css',
'//cdn.datatables.net/rowgroup/1.5.0/css/rowGroup.bootstrap4.min.css',
//'//cdn.datatables.net/rowgroup/1.5.0/css/rowGroup.dataTables.min.css',
],
'js' => [
'//cdn.datatables.net/rowgroup/1.1.2/js/dataTables.rowGroup.min.js',
'//cdn.datatables.net/rowgroup/1.5.0/js/dataTables.rowGroup.min.js',
//'//cdn.datatables.net/rowgroup/1.5.0/js/rowGroup.dataTables.min.js',
'//cdn.datatables.net/rowgroup/1.1.2/js/rowGroup.bootstrap5.min.js',
'//cdn.datatables.net/rowgroup/1.5.0/js/rowGroup.bootstrap4.min.js',
],
],
'searchpanes' => [
@ -111,14 +109,17 @@ class PageAssets
'select2' => [
'base' => [
'css' => [
'//cdn.jsdelivr.net/npm/select2@4.0.13/dist/css/select2.min.css',
'//cdn.jsdelivr.net/npm/select2-bootstrap-5-theme@1.3.0/dist/select2-bootstrap-5-theme.min.css',
'//cdnjs.cloudflare.com/ajax/libs/select2/4.0.13/css/select2.min.css',
],
'js' => [
'//cdn.jsdelivr.net/npm/select2@4.0.13/dist/js/select2.full.min.js',
'/plugin/select2/fix-autofocus.js',
'//cdnjs.cloudflare.com/ajax/libs/select2/4.0.13/js/select2.min.js',
],
],
'autofocus' => [
'js' => [
'/plugin/select2/fix-autofocus.js',
],
]
],
'simplemde' => [
'base' => [

View File

@ -49,9 +49,6 @@ class SystemController extends Controller
$o->autohold = FALSE;
$o->save();
if ($o->wasRecentlyCreated)
$o->users()->attach(Auth::id());
$mailers = collect($request->post('mailer_details'))
->filter(function($item) { return $item['port']; })
->transform(function($item) { $item['active'] = Arr::get($item,'active',FALSE); return $item; });
@ -173,9 +170,7 @@ class SystemController extends Controller
// Make sure that no other system has this address active.
if ($o->role_id === Address::NODE_NN)
return redirect()
->back()
->withErrors(['address'=>sprintf('%s cannot be demoted any more',$o->ftn3D)]);
return redirect()->back()->withErrors(['address'=>sprintf('%s cannot be demoted any more',$o->ftn3D)]);
$off = $o->role_id;
$o->role &= ~$off;
@ -183,8 +178,7 @@ class SystemController extends Controller
$o->save();
return redirect()
->to(sprintf('system/addedit/%d',$o->system_id));
return redirect()->to(sprintf('system/addedit/%d',$o->system_id));
}
public function address_merge(AddressMerge $request,int $id)
@ -354,10 +348,8 @@ class SystemController extends Controller
session()->flash('accordion','address');
// Make sure that no other system has this address active.
if ($o->role_id === Address::NODE_HC)
return redirect()
->back()
->withErrors(['address'=>sprintf('%s cannot be promoted any more',$o->ftn3D)]);
if ($o->role_id === Address::NODE_NC)
return redirect()->back()->withErrors(['address'=>sprintf('%s cannot be promoted any more',$o->ftn3D)]);
$off = $o->role_id;
$o->role &= ~$off;
@ -365,8 +357,7 @@ class SystemController extends Controller
$o->save();
return redirect()
->to(sprintf('system/addedit/%d',$o->system_id));
return redirect()->to(sprintf('system/addedit/%d',$o->system_id));
}
/**
@ -630,19 +621,39 @@ class SystemController extends Controller
*/
public function register(SystemRegisterRequest $request)
{
// During the BBS linking process, if the user selected a system will link to confirm it
if ($request->action === 'register' && $request->system_id && is_numeric($request->system_id))
return redirect()
->to(sprintf('user/system/register_confirm/%d',$request->system_id));
if ($request->action === 'register' && $request->name && is_numeric($request->name))
return view('user.system.widget.register_confirm')
->with('o',System::findOrFail($request->name));
// Re-flash our previously input data, we must be creating a new system
session()->flashInput([
'name'=>$request->system_id,
'sysop'=>Auth::user()->name,
]);
$o = System::findOrNew(is_numeric($request->system_id) ? $request->system_id : NULL);
return redirect()
->to('system/addedit');
// If the system doesnt exist, we'll create it
if (! $o->exist) {
$o->sysop = Auth::user()->name;
foreach (['name','zt_id','location','phone','method','address','port'] as $item)
if ($request->{$item})
$o->{$item} = $request->{$item};
$o->active = TRUE;
}
if ($request->post('submit')) {
Auth::user()->systems()->save($o);
// @todo if the system already exists and part of one of our networks, we'll need to send the registration email to confirm the address.
// @todo mark the system (or addresses) as "pending" at this stage until it is confirmed
return redirect()->to(url('system/addedit',$o->id));
}
// Re-flash our previously input data
if ($request->old)
session()->flashInput($request->old);
return view('system.widget.system')
->with('action',$request->action)
->with('o',$o)
->with('errors',new ViewErrorBag);
}
/**
@ -684,16 +695,9 @@ class SystemController extends Controller
$this->authorize('update_nn',$o);
session()->flash('accordion','session');
// Remove the subscription to file/echo areas for each address affected
foreach ($o->akas->where('zone_id',$zo->id) as $ao) {
$ao->echoareas()->detach();
$ao->fileareas()->detach();
}
$o->sessions()->detach($zo);
return redirect()
->to(sprintf('system/addedit/%d',$o->id));
return redirect()->to(sprintf('system/addedit/%d',$o->id));
}
// @todo Can this be consolidated with system_register()

View File

@ -64,9 +64,7 @@ class UserController extends Controller
'code', 'Invalid Code!'
);
return back()
->withInput()
->withErrors($validator);
return back()->withErrors($validator);
}
}

View File

@ -56,11 +56,8 @@ class SystemRegisterRequest extends FormRequest
return [];
$so = $this->route('o');
// When we have selected a system during the register/linking process
if ((! $so) && ($request->action === 'register'))
// If system ID is not numeric, then its a new system
return is_numeric($request->system_id) ? ['system_id'=>'required|exists:systems,id'] : [];
return [];
return array_filter(array_merge([
'name' => 'required|min:3',
@ -71,16 +68,14 @@ class SystemRegisterRequest extends FormRequest
'port' => 'nullable|digits_between:2,5',
'method' => 'nullable|numeric',
'mailer_details.*' => 'nullable|array',
// @todo Port should be present if active is true
'mailer_details.*.port' => 'nullable|digits_between:2,5',
'mailer_details.*.active' => 'sometimes|boolean',
'zt_id' => 'nullable|size:10|regex:/^([A-Fa-f0-9]){10}$/|unique:systems,zt_id,'.($so ? $so->id : 0),
'pkt_type' => ['required',Rule::in(array_keys(Packet::PACKET_TYPES))],
],($so && $so->exists) ? [
'users' => 'nullable|array|min:1|max:2',
'active' => 'required|boolean',
'hold' => 'sometimes|boolean',
'pollmode' => 'required|integer|min:0|max:2',
],($so && $so->exists) ? [
'users' => 'nullable|array|min:1|max:2',
'heartbeat' => [
'nullable',
'integer',

View File

@ -25,13 +25,6 @@ class SystemPolicy
{
use HandlesAuthorization;
public function admin(User $user, System $system): bool
{
// Site Admins can always create
// If it doesnt exist, then a user can create it.
return ($user->isAdmin() || (! $system->exists));
}
/**
* Determine whether the user can create the model.
*
@ -77,9 +70,9 @@ class SystemPolicy
if ($user->isAdmin())
return TRUE;
// If it doesnt exist, then its a true (they are creating it).
// If it doesnt exist, then its a false.
if (! $system->exists)
return TRUE;
return FALSE;
// @todo Permit ZC, RC, NC, HUB user

View File

@ -118,8 +118,7 @@ class System extends Model
->select(['zones.id','zones.zone_id','domain_id','zones.active'])
->join('domains',['domains.id'=>'zones.domain_id'])
->withPivot(['sespass','pktpass','ticpass','fixpass','zt_ipv4','zt_ipv6','default'])
->orderBy('domains.name')
->dontCache();
->orderBy('domains.name');
}
/**

View File

@ -2,7 +2,6 @@
namespace App\Providers;
use Illuminate\Foundation\AliasLoader;
use Illuminate\Http\Request;
use Illuminate\Notifications\ChannelManager;
use Illuminate\Support\Facades\Auth;
@ -10,16 +9,14 @@ use Illuminate\Support\Facades\Blade;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\Gate;
use Illuminate\Support\Facades\Notification;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\ServiceProvider;
use App\Events\Echomail as EchomailEvent;
use App\Events\Matrix\Message;
use App\Helpers\PageAssets;
use App\Listeners\EchomailListener;
use App\Listeners\Matrix\MessageListener;
use App\Notifications\Channels\{EchomailChannel,MatrixChannel,NetmailChannel};
use App\Models\{Echomail,Netmail,System,User};
use App\Models\{Echomail,Netmail,User};
use App\Traits\Single;
class AppServiceProvider extends ServiceProvider
@ -82,11 +79,5 @@ class AppServiceProvider extends ServiceProvider
EchomailEvent::class,
EchomailListener::class,
);
// Custom Aliases
$loader = AliasLoader::getInstance();
$loader->alias('PageAssets',PageAssets::class);
Route::model('so',System::class);
}
}

View File

@ -5,7 +5,6 @@ namespace App\Providers;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\ServiceProvider;
// @deprecated - now using pa()
class CustomBladeServiceProvider extends ServiceProvider
{
/**
@ -32,6 +31,14 @@ class CustomBladeServiceProvider extends ServiceProvider
'<link type="text/css" rel="stylesheet" href="https://cdn.datatables.net/1.10.25/css/dataTables.bootstrap5.min.css" media="screen">'.
'<link type="text/css" rel="stylesheet" href="'.asset('plugin/dataTables/dataTables.bootstrap5.css').'" media="screen">';
case 'select2':
return
'<link type="text/css" rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.13/css/select2.min.css">';
case 'simplemde':
return
'<link type="text/css" rel="stylesheet" href="https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.css">';
default:
throw new \Exception('Unknown CSS: '.$expression);
}
@ -55,6 +62,15 @@ class CustomBladeServiceProvider extends ServiceProvider
'<script type="text/javascript" src="https://code.highcharts.com/modules/export-data.js"></script>'.
'<script type="text/javascript" src="https://code.highcharts.com/themes/dark-unica.js"></script>';
case 'select2':
return
'<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.13/js/select2.min.js"></script>'.
'<script type="text/javascript" src="'.asset('plugin/select2/fix-autofocus.js').'"></script>';
case 'simplemde':
return
'<script type="text/javascript" src="https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.js"></script>';
default:
throw new \Exception('Unknown JS: '.$expression);
}

34
public/css/fixes.css vendored
View File

@ -1,27 +1,15 @@
/* Fixes for select 2 and our theme */
/* The opened input box */
.select2-container--bootstrap-5 .select2-dropdown .select2-search .select2-search__field {
line-height: 1.0;
border: 1px solid #aaa;
}
.select2-container--bootstrap-5 .select2-dropdown .select2-results__options .select2-results__option {
line-height: 1.2;
padding: 0.3rem 0.2rem 0.3rem 0.4rem;
font-size: 85%;
}
select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__clear, .select2-container--bootstrap-5 .select2-selection--single .select2-selection__clear
{
width: 0.5rem;
height: 0.5rem;
}
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered .select2-selection__placeholder
{
line-height: 1.0;
font-size: 90%;
}
/*
.select2 .select2-container .select2-container--classic { width: 80% !important;}
*/
.select2-container .select2-selection--single { border-radius: 0 4px 4px 0; height: inherit;}
.select2-container .select2-selection--single .select2-selection__rendered { line-height: 36px; }
.select2-container--classic .select2-selection--single .select2-selection__arrow { line-height: 36px; }
.select2-results { color: #000; }
/*
.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable,
*/
.select2-container--default .select2-results__option--selected { background-color: #024cc4; color: #eeeeee;}
/* Bootstrap 5 fixes */
/* select import, round the right side */

View File

@ -1,27 +0,0 @@
<div class="form-group">
@if(isset($label))
<label {{ $attributes->only(['class'])->merge(['class'=>'form-label']) }} for="{{ $id ?? $name }}">{!! html_entity_decode($label) !!}</label>
@endisset
<div class="input-group has-validation">
@if(isset($icon) || isset($prepend))
{{-- // messes with the icon box, we have rounded corners on the right side
<div class="input-group-prepend">
--}}
<span class="input-group-text">@isset($icon)<i class="bi {{ $icon }}"></i>@endisset @isset($prepend){!! $prepend !!}@endisset</span>
{{--
</div>
--}}
@endif
{{ $slot }}
<span class="invalid-feedback">
@error((! empty($old)) ? $old : $name)
{{ $message }}
@elseif(isset($feedback))
{{ $feedback }}
@enderror
</span>
</div>
@isset($helper)
<span class="input-helper">{!! html_entity_decode($helper) !!}</span>
@endif
</div>

View File

@ -1,61 +0,0 @@
<x-form.base {{ $attributes }}>
<input type="hidden" id="{{ $name }}_disabled" name="{{ $name }}" value="" disabled>
<select style="width: 80%" class="form-select @error((! empty($old)) ? $old : $name) is-invalid @enderror" id="{{ $id ?? $name }}" name="{{ $name }}" @required(isset($required) && $required) @disabled(isset($disabled) && $disabled)>
@if(empty($value) || isset($addnew) || isset($choose))
<option value=""></option>
@isset($addnew)
<option value="new">{{ $addnew ?: 'Add New' }}</option>
@endisset
@endif
@isset($options)
@empty($groupby)
@foreach($options as $option)
@continue(! Arr::get($option,'value'))
<option value="{{ Arr::get($option,'id') }}" @selected(Arr::get($option,'id') == old($old ?? $name,$value ?? ''))>{{ Arr::get($option,'value') }}</option>
@endforeach
@else
@foreach($options->groupBy($groupby) as $group)
<optgroup label="{{ $groupby == 'active' ? (Arr::get($group->first(),$groupby) ? 'Active' : 'Not Active') : Arr::get($group->first(),$groupby) }}">
@foreach($group as $option)
@continue(! Arr::get($option,'value'))
<option value="{{ Arr::get($option,'id') }}" @selected(Arr::get($option,'id') == old($old ?? $name,$value ?? ''))>{{ Arr::get($option,'value') }}</option>
@endforeach
</optgroup>
@endforeach
@endempty
@endisset
</select>
</x-form.base>
@pa(select2)
@section('page-scripts')
<script type="text/javascript">
// Select doesnt support read only so we'll use disable and a new field
function {{$id ?? $name}}_readonly(on) {
if (on) {
$('#{{ $name }}').prop('disabled',true);
$('#{{ $name }}_disabled').prop('disabled',false).val($('#{{ $name }}').val());
} else {
$('#{{ $name }}').prop('disabled',false);
$('#{{ $name }}_disabled').prop('disabled',true);
}
}
$(document).ready(function() {
$('#{{ $id ?? $name }}').select2({
theme: 'bootstrap-5',
dropdownAutoWidth: true,
width: 'style',
allowClear: true,
placeholder: '{{ $placeholder ?? '' }}',
@isset($addvalues)
tags: true,
@endisset
});
});
</script>
@append

View File

@ -1,5 +1,5 @@
<!-- $o=Domain::class -->
@use(App\Models\Echoarea)
<!-- $o=Domain::class -->
@extends('layouts.app')
@ -8,7 +8,7 @@
@endsection
@section('content')
<form class="needs-validation" method="post" autocomplete="off" novalidate>
<form class="needs-validation" method="post" novalidate>
@csrf
<div class="row">
@ -137,12 +137,22 @@
</div>
<div class="col-4">
@if ($o->isManaged())
@php
$helper = (! $o->nodestatus_id)
? sprintf('Add a <a href="%s">NEW Echoarea</a>. This echoarea is used to send node status messages.',url('echoarea/addedit'))
: sprintf('<a href="%s">Edit</a> Echoarea',url('echoarea/addedit',[$o->nodestatus_id]));
@endphp
<x-form.select name="nodestatus_id" icon="bi-journal-text" label="Echoarea Node Status" :helper="$helper" :value="$o->nodestatus_id" :options="Echoarea::select('id','description')->active()->where('domain_id',$o->id)->orderBy('description')->cursor()->map(fn($item)=>['id'=>$item->id,'value'=>$item->description])"/>
<label for="nodestatus_id" class="form-label">Echoarea Node Status</label>
<div class="input-group has-validation">
<span class="input-group-text"><i class="bi bi-journal-text"></i></span>
<select style="width: 80%;" class="form-select @error('nodestatus_id') is-invalid @enderror" id="nodestatus_id" name="nodestatus_id" @cannot('admin',$o)disabled @endcannot>
<option value="">&nbsp;</option>
@foreach (Echoarea::active()->where('domain_id',$o->id)->orderBy('description')->cursor() as $oo)
<option value="{{ $oo->id }}" @if(old('nodestatus_id',$o->nodestatus_id)==$oo->id)selected @endif>{{ $oo->description }}</option>
@endforeach
</select>
<span class="invalid-feedback" role="alert">
@error('nodestatus_id')
{{ $message }}
@enderror
</span>
<span class="input-helper">Add a <a href="{{ url('echoarea/addedit') }}">NEW Echoarea</a>. This echoarea is used to send node status messages.</span>
</div>
@endif
</div>
</div>
@ -185,10 +195,21 @@
</form>
@endsection
@pa(simplemde)
@section('page-css')
@css('simplemde')
@css('select2')
@append
@section('page-scripts')
<script type="text/javascript">
var simplemde = new SimpleMDE({ element: $("#homepage")[0] });
</script>
@js('simplemde')
@js('select2')
@can('admin',$o)
<script type="text/javascript">
var simplemde = new SimpleMDE({ element: $("#homepage")[0] });
$(document).ready(function() {
$('#nodestatus_id').select2();
});
</script>
@endcan
@append

View File

@ -1,4 +1,3 @@
<!-- $o=Echoarea::class -->
@use(App\Models\Domain)
@extends('layouts.app')
@ -8,7 +7,7 @@
@endsection
@section('content')
<form class="needs-validation" method="post" autocomplete="off" novalidate>
<form class="needs-validation" method="post" novalidate>
@csrf
<div class="row">
@ -18,12 +17,24 @@
<div class="row">
<div class="col-3">
@php
$helper = (! $o->domain_id)
? sprintf('Add a <a href="%s">NEW Domain</a>',url('domain/addedit'))
: NULL;
@endphp
<x-form.select name="domain_id" icon="bi-tag-fill" label="Domain" feedback="Domain is required" :helper="$helper" :value="$o->domain_id" :options="Domain::active()->orderBy('name')->cursor()->map(fn($item)=>['id'=>$item->id,'value'=>$item->name])" required/>
<label for="domain" class="form-label">Domain</label>
<div class="input-group has-validation">
<span class="input-group-text"><i class="bi bi-tag-fill"></i></span>
<select class="form-select @error('domain_id') is-invalid @enderror" id="domain" name="domain_id" required @cannot('admin',$o)disabled @endcannot>
<option value="">&nbsp;</option>
@foreach (Domain::active()->orderBy('name')->cursor() as $oo)
<option value="{{ $oo->id }}" @if(old('domain_id',$o->domain_id)==$oo->id)selected @endif>{{ $oo->name }}</option>
@endforeach
</select>
<span class="invalid-feedback" role="alert">
@error('domain_id')
{{ $message }}
@else
A domain is required.
@enderror
</span>
<span class="input-helper">Add a <a href="{{ url('domain/addedit') }}">NEW Domain</a></span>
</div>
</div>
<div class="col-3">
@ -159,7 +170,7 @@
<div class="col-12">
<h3>Exporting to the following adresses:</h3>
<table class="table monotable" id="systems">
<table class="table monotable" id="system">
<thead>
<tr>
<th>System</th>
@ -174,7 +185,7 @@
@foreach ($o->addresses as $ao)
<tr>
<td><a href="{{ url('system/addedit',[$ao->system_id]) }}">{{ $ao->system->full_name($ao) }}</a> @auth<span class="float-end"><small>@if($ao->is_hosted)<sup>{{ $ao->is_default ? '**' : '*' }}</sup>@elseif($ao->system->setup)<sup class="success">+</sup>@endif[{{ $ao->system_id }}]</small></span>@endauth</td>
<td>{{ $ao->ftn4d }}</td>
<td>{{ $ao->ftn_3d }}</td>
<td>{{ $ao->system->last_seen?->format('Y-m-d H:i') ?: '-' }}</td>
<td>{{ ($x=$o->waiting($ao))->count() ? $x->first()->datetime->format('Y-m-d H:i') : '-' }}</td>
<td class="text-end">{{ number_format($x->count()) }}</td>
@ -187,24 +198,4 @@
@endif
@endcan
</form>
@endsection
@pa(datatables,conditionalpaging)
@section('page-scripts')
<script type="text/javascript">
$(document).ready(function() {
$('#systems').DataTable({
paging: true,
pageLength: 25,
searching: true,
ordering: true,
order: [1,'asc'],
conditionalPaging: {
style: 'fade',
speed: 500 // optional
},
});
});
</script>
@append
@endsection

View File

@ -1,7 +1,6 @@
<!-- $o=Filearea::class -->
@use(App\Models\Domain)
@use(App\Classes\FTN\Message)
@extends('layouts.app')
@section('htmlheader_title')
@ -9,7 +8,7 @@
@endsection
@section('content')
<form class="needs-validation" method="post" autocomplete="off" novalidate>
<form class="needs-validation" method="post" novalidate>
@csrf
<div class="row">
@ -19,12 +18,24 @@
<div class="row">
<div class="col-3">
@php
$helper = (! $o->domain_id)
? sprintf('Add a <a href="%s">NEW Domain</a>',url('domain/addedit'))
: NULL;
@endphp
<x-form.select name="domain_id" icon="bi-tag-fill" label="Domain" feedback="Domain is required" :helper="$helper" :value="$o->domain_id" :options="Domain::active()->orderBy('name')->cursor()->map(fn($item)=>['id'=>$item->id,'value'=>$item->name])" required/>
<label for="domain" class="form-label">Domain</label>
<div class="input-group has-validation">
<span class="input-group-text"><i class="bi bi-tag-fill"></i></span>
<select class="form-select @error('domain_id') is-invalid @enderror" id="domain" name="domain_id" required @cannot('admin',$o)disabled @endcannot>
<option value="">&nbsp;</option>
@foreach (Domain::active()->orderBy('name')->cursor() as $oo)
<option value="{{ $oo->id }}" @if(old('domain_id',$o->domain_id)==$oo->id)selected @endif>{{ $oo->name }}</option>
@endforeach
</select>
<span class="invalid-feedback" role="alert">
@error('domain_id')
{{ $message }}
@else
A domain is required.
@enderror
</span>
<span class="input-helper">Add a <a href="{{ url('domain/addedit') }}">NEW Domain</a></span>
</div>
</div>
<div class="col-4">
@ -146,8 +157,6 @@
</div>
</div>
<!-- @todo Show exported systems and files waiting -->
<div class="row">
<div class="col-12">
@if ($o->files->count())
@ -182,9 +191,13 @@
</form>
@endsection
@pa(datatables,conditionalpaging)
@section('page-css')
@css('datatables')
@append
@section('page-scripts')
@js('datatables')
<script type="text/javascript">
$(document).ready(function() {
$('#files').DataTable({

View File

@ -20,6 +20,8 @@
{{-- Scripts --}}
@section('scripts')
@include('layouts.partials.scripts')
@yield('page-scripts')
@show
</body>
</html>

View File

@ -10,15 +10,11 @@
<meta name="csrf-token" content="{{ csrf_token() }}">
<!-- CSS only -->
<link type="text/css" rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<link type="text/css" rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<link type="text/css" rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.css">
<link type="text/css" rel="stylesheet" href="{{ url('oldschool/css/main.css') }}" media="screen">
<!-- Page Asset Styles -->
{!! PageAssets::css() !!}
<!-- Page Styles -->
@yield('page-css')
@if(file_exists('css/fixes.css'))
@ -26,6 +22,5 @@
<link rel="stylesheet" href="{{ asset('css/fixes.css') }}">
@endif
<!-- Favicon -->
<link type="image/png" rel="icon" href="{{ asset('favicon.ico') }}">
</head>

View File

@ -3,7 +3,7 @@
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.21/lodash.min.js" integrity="sha512-WFN04846sdKMIP5LKNphMaWzU7YpMyCU245etK3g/2ARYbPK9Ub18eG+ljU96qKRCWh+quCY7yefSmlkQw1ANQ==" crossorigin="anonymous"></script>
<!-- JavaScript Bundle with Popper -->
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
<!-- Additional Utilities -->
<script src="{{ asset('plugin/bootstrap3-typeahead/bootstrap3-typeahead.min.js') }}"></script>
@ -36,10 +36,4 @@
}, false)
});
})()
</script>
<!-- Page Script Assets -->
{!! PageAssets::js() !!}
<!-- Page Scripts -->
@yield('page-scripts')
</script>

View File

@ -9,7 +9,7 @@
@endsection
@section('content')
<form class="needs-validation" method="post" enctype="multipart/form-data" autocomplete="off" novalidate>
<form class="needs-validation" method="post" enctype="multipart/form-data" novalidate>
@csrf
<div class="row">

View File

@ -1,8 +1,8 @@
<!-- $o = Setup::class -->
@use(App\Classes\Protocol\Binkp)
@use(App\Classes\Protocol\EMSI)
@use(App\Models\Setup)
@use(App\Models\System)
@php
use App\Models\Setup;
use App\Classes\Protocol\{Binkp,EMSI,DNS};
@endphp
@extends('layouts.app')
@section('htmlheader_title')
@ -10,7 +10,7 @@
@endsection
@section('content')
<form class="needs-validation" method="post" autocomplete="off" novalidate>
<form class="needs-validation" method="post" novalidate>
@csrf
<div class="row">
@ -23,12 +23,30 @@
<div class="row">
<!-- System -->
<div class="col-4">
@php
$helper = (! $o->system_id)
? sprintf('Add a <a href="%s">NEW System"</a>',url('system/addedit'))
: sprintf('<a href="%s">Edit</a> System',url('system/addedit',[$o->system_id]));
@endphp
<x-form.select name="system_id" icon="bi-tag-fill" label="System" feedback="A system is required" placeholder="Select System" :helper="$helper" :value="$o->system_id" :options="System::select(['id','name'])->active()->cursor()->map(fn($item)=>['id'=>$item->id,'value'=>$item->name])" required/>
<label for="system_id" class="form-label">System</label>
<div class="input-group has-validation">
<span class="input-group-text"><i class="bi bi-tag-fill"></i></span>
<select style="width: 80%;" class="form-select @error('system_id') is-invalid @enderror" id="system_id" name="system_id" required @cannot('admin',$o)disabled @endcannot>
<option value="">&nbsp;</option>
@foreach (\App\Models\System::active()->cursor() as $oo)
<option value="{{ $oo->id }}" @if(old('system_id',$o->system_id)==$oo->id)selected @endif>{{ $oo->name }}</option>
@endforeach
</select>
<span class="invalid-feedback" role="alert">
@error('system_id')
{{ $message }}
@else
A system is required.
@enderror
</span>
<span class="input-helper">
@if(! $o->system_id)
Add a <a href="{{ url('system/addedit') }}">NEW System</a>
@else
<a href="{{ url('system/addedit',[$o->system_id]) }}">Edit</a> System
@endif
</span>
</div>
</div>
<!-- System Addresses -->
@ -283,9 +301,23 @@
@endsection
@section('page-css')
@css('select2')
<style>
#content h3 {
margin-bottom: 5px;
}
#content ul li:last-child {
margin-bottom: inherit;
}
</style>
@append
@section('page-scripts')
@js('select2')
<script type="text/javascript">
$(document).ready(function() {
$('#system_id').select2();
});
</script>
@append

View File

@ -1,8 +1,8 @@
<!-- $o=System::class -->
@use(App\Models\Address)
@use(App\Models\Echomail)
@use(App\Models\File)
@use(App\Models\Netmail)
<!-- $o=System::class -->
@extends('layouts.app')
@ -142,10 +142,10 @@
<a href="{{ url('system/address/sus',[$oo->id]) }}" title="@if($oo->active)Pause @else Activate @endif Address"><i class="bi @if($oo->active)bi-pause-circle @else bi-play-circle @endif"></i></a>
<a href="{{ url('system/address/mov',[$o->id,$oo->id]) }}" title="Move Address to another System"><i class="bi bi-arrow-right-square"></i></a>
<a href="{{ url('system/address/del',[$oo->id]) }}" title="Delete Address"><i class="bi bi-trash"></i></a>
@if ($oo->role_id === Address::NODE_NN)
@if ((Address::NODE_HC|Address::NODE_NN) & $oo->role_id)
<a href="{{ url('system/address/pro',[$oo->id]) }}" title="Promote Address"><i class="bi bi-arrow-up-square"></i></a>
@endif
@if ($oo->role_id === Address::NODE_HC)
@if ((Address::NODE_NC|Address::NODE_HC) & $oo->role_id)
<a href="{{ url('system/address/dem',[$oo->id]) }}" title="Demote Address"><i class="bi bi-arrow-down-square"></i></a>
@endif
@endif
@ -617,47 +617,39 @@
@section('page-scripts')
<script type="text/javascript">
$(document).ready(function () {
if (window.location.hash) {
$('#collapse_'+window.location.hash.substring(1)).show();
$('#collapse_system').collapse()
}
@can('admin')
$('.default').click(function () {
var item = this;
icon = $(item).find('i');
@if($o->exists)
@can('admin')
$('.default').click(function () {
var item = this;
icon = $(item).find('i');
$.ajax({
type: 'POST',
data: {sid: {{$o->id}}, _token: '{{csrf_token()}}', set: (icon.hasClass('bi-square') ? 1 : 0)},
beforeSend: function () {
$(item).find('i').addClass('spinner-grow spinner-grow-sm');
},
success: function () {
if (icon.hasClass('bi-square')) {
icon.removeClass('bi-square');
icon.addClass('bi-check-square');
} else {
icon.removeClass('bi-check-square');
icon.addClass('bi-square');
}
$.ajax({
type: 'POST',
data: {sid: {{$o->id}}, _token: '{{csrf_token()}}', set: (icon.hasClass('bi-square') ? 1 : 0)},
beforeSend: function () {
$(item).find('i').addClass('spinner-grow spinner-grow-sm');
},
success: function () {
if (icon.hasClass('bi-square')) {
icon.removeClass('bi-square');
icon.addClass('bi-check-square');
} else {
icon.removeClass('bi-check-square');
icon.addClass('bi-square');
}
$(item).find('i').removeClass('spinner-grow spinner-grow-sm');
},
error: function (e) {
$(item).find('i').removeClass('spinner-grow spinner-grow-sm');
if (e.status != 412)
alert('That didnt work? Please try again....');
},
url: '{{ url('zone/api/default') }}/' + item.attributes.itemid.nodeValue,
cache: false
})
});
@endcan
@endif
$(item).find('i').removeClass('spinner-grow spinner-grow-sm');
},
error: function (e) {
$(item).find('i').removeClass('spinner-grow spinner-grow-sm');
if (e.status != 412)
alert('That didnt work? Please try again....');
},
url: '{{ url('zone/api/default') }}/' + item.attributes.itemid.nodeValue,
cache: false
})
});
@endcan
$('data.validated').on('click',function(item) {
that = $(this);
var values = item.delegateTarget.value.split(':');

View File

@ -6,7 +6,7 @@
@endsection
@section('content')
<form class="needs-validation" method="post" autocomplete="off" novalidate>
<form class="needs-validation" method="post" novalidate>
@csrf
<div class="row">

View File

@ -1,5 +1,3 @@
<!-- $ao=Address::class -->
<!-- $o=System::class -->
@extends('layouts.app')
@section('htmlheader_title')
@ -15,38 +13,74 @@
@includeWhen(session()->has('success'),'widgets.success',['msg'=>session()->get('success')])
<form class="needs-validation" method="post" autocomplete="off" novalidate>
<form class="needs-validation" method="post" novalidate>
@csrf
<div class="row pt-0">
<div class="col-2">
<x-form.select name="to" icon="bi-robot" label="To" feedback="To name required" :value="($x=collect(config('fido.areafilefix')))->first()" :options="$x->map(fn($item)=>['id'=>$item,'value'=>$item])" required/>
<label for="to" class="form-label">To</label>
<div class="input-group">
<span class="input-group-text"><i class="bi bi-ui-radios"></i></span>
<select class="form-select @error('to') is-invalid @enderror" id="to" name="to">
@foreach (config('fido.areafilefix') as $name)
<option value="{{ $name }}" @if(old('to' === $name ))selected @endif>{{ $name }}</option>
@endforeach
</select>
<span class="invalid-feedback" role="alert">
@error('to')
{{ $message }}
@enderror
</span>
</div>
</div>
<div class="offset-2 col-3">
<x-form.select name="tftn_id" icon="bi-ui-radios" label="Uplink Address" feedback="Uplink address required" :value="($x=collect(config('fido.areafilefix')))->first()" :options="$o->akas->where('zone_id',$zo->id)->map(fn($item)=>['id'=>$item->id,'value'=>$item->ftn])" required/>
<label for="tftn_id" class="form-label">Address</label>
<div class="input-group">
<span class="input-group-text"><i class="bi bi-ui-radios"></i></span>
<select class="form-select @error('tftn_id') is-invalid @enderror" id="tftn_id" name="tftn_id">
@foreach ($o->akas->where('zone_id',$zo->id) as $ao)
<option value="{{ $ao->id }}" @if(old('tftn_id' === $ao->id))selected @endif>{{ $ao->ftn }}</option>
@endforeach
</select>
<span class="invalid-feedback" role="alert">
@error('tftn_id')
{{ $message }}
@enderror
</span>
</div>
</div>
</div>
<div class="row">
<!-- SUBJECT -->
<div class="col-3">
<label for="subject" class="form-label">Subject</label>
<div class="input-group has-validation">
<span class="input-group-text @error('subject') is-invalid @enderror"><i class="bi bi-pass"></i></span>
<input type="text" class="form-control" id="subject" placeholder="Areafix Password" name="subject" value="{{ old('subject',$ao->pass_fix) }}" required>
<div class="input-group">
<span class="input-group-text @error('subject') is-invalid @enderror"><i class="bi bi-wifi"></i></span>
<input type="text" class="form-control" id="subject" placeholder="Areafix Password" name="subject" value="{{ old('subject',$ao->pass_fix) }}">
<span class="invalid-feedback" role="alert">
@error('subject')
{{ $message }}
@else
Area/filefix password is required
@enderror
</span>
</div>
</div>
<div class="offset-1 col-3">
<x-form.select name="fftn_id" icon="bi-ui-radios" label="Our address" feedback="Our address required" :value="$ao->id" :options="$setup->system->akas->where('zone_id',$zo->id)->map(fn($item)=>['id'=>$item->id,'value'=>$item->ftn])" required/>
<label for="fftn_id" class="form-label">From</label>
<div class="input-group">
<span class="input-group-text"><i class="bi bi-ui-radios"></i></span>
<select class="form-select @error('fftn_id') is-invalid @enderror" id="fftn_id" name="fftn_id">
@foreach ($setup->system->akas->where('zone_id',$zo->id) as $ao)
<option value="{{ $ao->id }}" @if(old('fftn_id' === $ao->id))selected @endif>{{ $ao->ftn }}</option>
@endforeach
</select>
<span class="invalid-feedback" role="alert">
@error('fftn_id')
{{ $message }}
@enderror
</span>
</div>
</div>
</div>
@ -54,12 +88,10 @@
<!-- Message -->
<div class="col-12">
<label for="msg" class="form-label">Message</label>
<textarea class="form-control @error('msg') is-invalid @enderror" rows=10 name="msg" placeholder="Message..." required>{{ old('msg') }}</textarea>
<textarea class="form-control @error('msg') is-invalid @enderror" rows=10 name="msg" placeholder="Message...">{{ old('msg') }}</textarea>
<span class="invalid-feedback" role="alert">
@error('msg')
{{ $message }}
@else
Area/filefix commands are required
@enderror
</span>
</div>
@ -71,4 +103,14 @@
</div>
</div>
</form>
@endsection
@endsection
@section('page-css')
@append
@section('page-scripts')
<script type="text/javascript">
$(document).ready(function() {
});
</script>
@append

View File

@ -1,6 +1,3 @@
<!-- $o=Address::class -->
@use(App\Models\System)
@extends('layouts.app')
@section('htmlheader_title')
@ -8,7 +5,7 @@ Move Address
@endsection
@section('content')
<form class="needs-validation" method="post" autocomplete="off" novalidate>
<form class="needs-validation" method="post" novalidate>
@csrf
<div class="row">
@ -25,11 +22,26 @@ Move Address
<div class="row">
<!-- Choose System -->
<div class="col-4">
@php
$helper = sprintf('Add a <a href="%s">NEW System</a>',url('system/addedit'));
$label = sprintf('Move <strong class="highlight">%s</strong> to system',$o->ftn);
@endphp
<x-form.select name="system_id" icon="bi-envelope-at-fill" :label="$label" placeholder="Select System" feedback="System is required" :helper="$helper" :value="$o->system_id" :options="System::select(['id','name'])->active()->where('id','<>',$o->system_id)->cursor()->map(fn($item)=>['id'=>$item->id,'value'=>$item->name])" required/>
<label for="system_id" class="form-label">Move <strong class="highlight">{{ $o->ftn }}</strong> to system:</label>
<div class="input-group has-validation">
<span class="input-group-text"><i class="bi bi-display-fill"></i></span>
<select style="width: 80%;" class="form-select @error('system_id') is-invalid @enderror" id="system_id" name="system_id" required @cannot('admin',$o)disabled @endcannot>
<option value="">&nbsp;</option>
@foreach (\App\Models\System::active()->where('id','<>',$o->system_id)->cursor() as $oo)
<option value="{{ $oo->id }}" @if(old('system_id')==$oo->id)selected @endif>{{ $oo->name }}</option>
@endforeach
</select>
<span class="invalid-feedback" role="alert">
@error('system_id')
{{ $message }}
@else
Please select the System that should have the address.
@enderror
</span>
<span class="input-helper">
Add a <a href="{{ url('system/addedit') }}">NEW System</a>
</span>
</div>
</div>
<div class="col-3">
@ -97,9 +109,16 @@ Move Address
</form>
@endsection
@section('page-css')
@css('select2')
@append
@section('page-scripts')
@js('select2')
<script type="text/javascript">
$(document).ready(function() {
$('#system_id').select2();
@if ($o->is_hosted)
$('#remove_yes').on('change',function() {
if (! $('#session-remove').hasClass('d-none'))

View File

@ -1,6 +1,4 @@
@use(App\Models\Zone)
<form class="needs-validation" method="post" action="{{ url('system/address/add',$o->id) }}" autocomplete="off" novalidate>
<form class="needs-validation" method="post" action="{{ url('system/address/add',$o->id) }}" novalidate>
@csrf
<input type="hidden" id="action" name="action" value="">
@ -10,22 +8,70 @@
<div class="row">
<!-- Select Zone -->
<div class="col-3">
<x-form.select name="zone_id" icon="bi-hash" label="Zone" :options="Zone::select(['id','zone_id','domain_id'])->active()->domainZoneOrder()->with(['domain'])->cursor()->map(fn($item)=>['id'=>$item->id,'value'=>sprintf('%d [%s]',$item->zone_id,$item->domain->name)])" required/>
<label for="zone_id" class="form-label">Zone</label>
<div class="input-group has-validation">
<span class="input-group-text"><i class="bi bi-hash"></i></span>
<select class="form-select @error('zone_id') is-invalid @enderror" id="zone_id" name="zone_id" required>
<option></option>
@foreach(\App\Models\Zone::active()->domainZoneOrder()->with(['domain'])->get() as $zo)
<option value="{{ $zo->id }}">{{ $zo->zone_id }} <small>({{ $zo->domain->name }})</small></option>
@endforeach
</select>
<span class="invalid-feedback" role="alert">
@error('zone_id')
{{ $message }}
@else
Please select the Zone for the node's address.
@enderror
</span>
</div>
</div>
<!-- Select Region -->
<div class="col-3 d-none" id="region-select">
<x-form.select name="region_id" icon="bi-geo" label="Region" required/>
<label for="region_id" class="form-label">Region</label>
<div class="input-group has-validation">
<span class="input-group-text"><i class="bi bi-geo"></i></span>
<select class="form-select @error('region_id') is-invalid @enderror" id="region_id" name="region_id" required>
</select>
<span class="invalid-feedback" role="alert">
@error('region_id')
{{ $message }}
@else
Please make a choice.
@enderror
</span>
</div>
</div>
<!-- Select Host -->
<div class="col-3 d-none" id="host-select">
<x-form.select name="host_id" icon="bi-diagram-3-fill" label="Host"/>
<label for="host_id" class="form-label">Host</label>
<div class="input-group has-validation">
<span class="input-group-text"><i class="bi bi-diagram-3-fill"></i></span>
<select class="form-select @error('host_id') is-invalid @enderror" id="host_id" name="host_id">
</select>
<span class="invalid-feedback" role="alert">
@error('host_id')
{{ $message }}
@enderror
</span>
</div>
</div>
<!-- Select Hub -->
<div class="col-3 d-none" id="hub-select">
<x-form.select name="hub_id" icon="bi-diagram-2-fill" label="Hub"/>
<label for="hub_id" class="form-label">Hub</label>
<div class="input-group has-validation">
<span class="input-group-text"><i class="bi bi-diagram-2-fill"></i></span>
<select class="form-select @error('hub_id') is-invalid @enderror" id="hub_id" name="hub_id">
</select>
<span class="invalid-feedback" role="alert">
@error('hub_id')
{{ $message }}
@enderror
</span>
</div>
</div>
</div>
@ -35,9 +81,9 @@
<label for="node_id" class="form-label">Node/Point Address</label>
<div class="input-group has-validation">
<span class="input-group-text"><i class="bi bi-hash"></i></span>
<input type="text" style="width: 35%;" class="form-control text-end @error('node_id') is-invalid @enderror" id="node_id" placeholder="Node" name="node_id" value="{{ old('node_id',$o->node_id) }}" @cannot('admin',$o)disabled @endcannot data-1p-ignore>
<input type="text" style="width: 35%;" class="form-control text-end @error('node_id') is-invalid @enderror" id="node_id" placeholder="Node" name="node_id" value="{{ old('node_id',$o->node_id) }}" @cannot('admin',$o)disabled @endcannot>
<span class="input-group-text p-0">.</span>
<input type="text" class="form-control pl-0 @error('point_id') is-invalid @enderror" id="point_id" placeholder="0" name="point_id" value="{{ old('point_id',$o->point_id) ?: 0 }}" @cannot('admin',$o)disabled @endcannot>
<input type="text" class="form-control @error('point_id') is-invalid @enderror" id="point_id" placeholder="0" name="point_id" value="{{ old('point_id',$o->point_id) ?: 0 }}" @cannot('admin',$o)disabled @endcannot style="padding-left: 0;">
<span class="invalid-feedback" role="alert">
@error('node_id')
{{ $message }}
@ -54,7 +100,7 @@
<label for="region_id_new" class="form-label">Region Address</label>
<div class="input-group has-validation">
<span class="input-group-text"><i class="bi bi-hash"></i></span>
<input type="text" style="width: 35%;" class="form-control @error('region_id_new') is-invalid @enderror" id="region_id_new" placeholder="Region #" name="region_id_new" value="{{ old('region_id_new') }}" @cannot('admin',$o)disabled @endcannot data-1p-ignore>
<input type="text" style="width: 35%;" class="form-control @error('region_id_new') is-invalid @enderror" id="region_id_new" placeholder="Region #" name="region_id_new" value="{{ old('region_id_new') }}" @cannot('admin',$o)disabled @endcannot>
<span class="input-group-text">/0.0</span>
<span class="invalid-feedback" role="alert">
@error('region_id_new')
@ -71,7 +117,7 @@
<label for="host_id_new" class="form-label">Host Address</label>
<div class="input-group has-validation">
<span class="input-group-text"><i class="bi bi-hash"></i></span>
<input type="text" class="form-control text-end @error('host_id_new') is-invalid @enderror" id="host_id_new" placeholder="Host #" name="host_id_new" value="{{ old('host_id_new') }}" @cannot('admin',$o)disabled @endcannot data-1p-ignore>
<input type="text" class="form-control text-end @error('host_id_new') is-invalid @enderror" id="host_id_new" placeholder="Host #" name="host_id_new" value="{{ old('host_id_new') }}" @cannot('admin',$o)disabled @endcannot>
<span class="input-group-text">/0.0</span>
<span class="invalid-feedback" role="alert">
@error('host_id_new')
@ -200,9 +246,6 @@
if (! $('#sec-level').hasClass('d-none'))
$('#sec-level').addClass('d-none')
if (! this.value)
return false;
var icon = $(this).parent().find('i');
icon.addClass('spinner-grow spinner-grow-sm');

View File

@ -1,4 +1,4 @@
<form class="needs-validation" method="post" action="{{ url('system/echoarea',$o->id) }}" autocomplete="off" novalidate>
<form class="needs-validation" method="post" action="{{ url('system/echoarea',$o->id) }}" novalidate>
@csrf
<div class="row pt-0">
@ -7,13 +7,33 @@
<div class="row">
<!-- Select Domain -->
<div class="col-3">
<x-form.select id="echoarea_domain_id" name="domain_id" icon="bi-hash" label="Network" :options="$o->sessions->map(fn($item)=>['id'=>$item->domain_id,'value'=>sprintf('%s (%s)',$item->zone_id,$item->domain->name)])"/>
<label for="echoarea_domain_id" class="form-label">Network</label>
<div class="input-group has-validation">
<span class="input-group-text"><i class="bi bi-hash"></i></span>
<select class="form-select @error('domain_id') is-invalid @enderror" id="echoarea_domain_id" name="domain_id" required>
<option></option>
@foreach($o->sessions as $zo)
<option value="{{ $zo->domain_id }}" @if(old('domain_id') == $zo->domain_id)selected @endif>{{ $zo->zone_id }} <small>({{ $zo->domain->name }})</small></option>
@endforeach
</select>
<span class="invalid-feedback" role="alert">
@error('domain_id')
{{ $message }}
@enderror
</span>
</div>
</div>
<!-- Select Address -->
<div class="col-3">
<div class="d-none" id="echoarea_address-select">
<x-form.select id="echoarea_address_id" name="address_id" icon="bi-hash" label="Address"/>
<label for="echoarea_address_id" class="form-label">Address</label>
<div class="input-group">
<span class="input-group-text"><i class="bi bi-hash"></i></span>
<select class="form-select" id="echoarea_address_id" name="address_id" required>
<option></option>
</select>
</div>
</div>
</div>
@ -66,15 +86,10 @@
<script type="text/javascript">
$(document).ready(function() {
$('#echoarea_domain_id').on('change',function() {
if (! $('#echoarea-select').hasClass('d-none'))
$('#echoarea-select').addClass('d-none');
if (! $(this).val()) {
$('#echoarea-summary').removeClass('d-none');
$('#echoarea_address-select').addClass('d-none');
return;
} else {
$('#echoarea_address-select').removeClass('d-none');
}

View File

@ -1,4 +1,4 @@
<form class="needs-validation" method="post" action="{{ url('system/filearea',$o->id) }}" autocomplete="off" novalidate>
<form class="needs-validation" method="post" action="{{ url('system/filearea',$o->id) }}" novalidate>
@csrf
<div class="row pt-0">
@ -7,13 +7,33 @@
<div class="row">
<!-- Select Domain -->
<div class="col-3">
<x-form.select id="filearea_domain_id" name="domain_id" icon="bi-hash" label="Network" :options="$o->sessions->map(fn($item)=>['id'=>$item->domain_id,'value'=>sprintf('%s (%s)',$item->zone_id,$item->domain->name)])"/>
<label for="domain_id" class="form-label">Network</label>
<div class="input-group has-validation">
<span class="input-group-text"><i class="bi bi-hash"></i></span>
<select class="form-select @error('domain_id') is-invalid @enderror" id="filearea_domain_id" name="domain_id" required>
<option></option>
@foreach($o->sessions as $zo)
<option value="{{ $zo->domain_id }}" @if(old('domain_id') == $zo->domain_id)selected @endif>{{ $zo->zone_id }} <small>({{ $zo->domain->name }})</small></option>
@endforeach
</select>
<span class="invalid-feedback" role="alert">
@error('domain_id')
{{ $message }}
@enderror
</span>
</div>
</div>
<!-- Select Address -->
<div class="col-3">
<div class="d-none" id="filearea_address-select">
<x-form.select id="filearea_address_id" name="address_id" icon="bi-hash" label="Address"/>
<label for="filearea_address_id" class="form-label">Address</label>
<div class="input-group">
<span class="input-group-text"><i class="bi bi-hash"></i></span>
<select class="form-select" id="filearea_address_id" name="address_id" required>
<option></option>
</select>
</div>
</div>
</div>
@ -53,16 +73,10 @@
<script type="text/javascript">
$(document).ready(function() {
$('#filearea_domain_id').on('change',function() {
console.log('closing filearea-select');
if (! $('#filearea-select').hasClass('d-none'))
$('#filearea-select').addClass('d-none');
if (! $(this).val()) {
$('#filearea-summary').removeClass('d-none');
$('#filearea_address-select').addClass('d-none');
return;
} else {
$('#filearea_address-select').removeClass('d-none');
}

View File

@ -1,14 +1,15 @@
<!-- $o = System::class -->
@use(App\Models\Zone)
@php
use App\Models\Zone;
@endphp
@if(($zones=Zone::select(['id','domain_id','zone_id'])
->active()
@if(($x=Zone::active()
->whereIn('id',$o->addresses->pluck('zone.id'))
->whereNotIn('id',$o->sessions->pluck('id'))
->with(['domain'])
->get())->count())
<form class="needs-validation" method="post" action="{{ url('system/session/add',$o->id) }}" autocomplete="off" novalidate>
<form class="needs-validation" method="post" action="{{ url('system/session/add',$o->id) }}" novalidate>
@csrf
<div class="row pt-0">
@ -19,13 +20,29 @@
<div class="row">
<!-- Select Zone -->
<div class="col-3">
<x-form.select id="szone_id" name="zone_id" icon="bi-hash" label="Zone" feedback="Our address required" value="x" :options="$zones->map(fn($item)=>['id'=>$item->id,'value'=>sprintf('%s (%s)',$item->zone_id,$item->domain->name)])" required/>
<label for="szone_id" class="form-label">Zone</label>
<div class="input-group has-validation">
<span class="input-group-text"><i class="bi bi-hash"></i></span>
<select class="form-select @error('zone_id') is-invalid @enderror" id="szone_id" name="zone_id" required>
<option></option>
@foreach($x as $zo)
<option value="{{ $zo->id }}" @if(old('zone_id') == $zo->id)selected @endif>{{ $zo->zone_id }} <small>({{ $zo->domain->name }})</small></option>
@endforeach
</select>
<span class="invalid-feedback" role="alert">
@error('zone_id')
{{ $message }}
@else
Please select the Zone for the node's address.
@enderror
</span>
</div>
</div>
<div class="col-9">
<div class="row pt-0">
<!-- Session -->
<div class="col-6">
<!-- Session -->
<label for="sespass" class="form-label">Session Password</label>
<div class="input-group has-validation">
<span class="input-group-text"><i class="bi bi-lock"></i></span>
@ -40,8 +57,8 @@
</div>
</div>
<!-- Packet -->
<div class="col-5">
<!-- Packet -->
<label for="pktpass" class="form-label">Packet Password</label>
<div class="input-group has-validation">
<span class="input-group-text"><i class="bi bi-box"></i></span>
@ -58,8 +75,8 @@
</div>
<div class="row">
<!-- Areafix -->
<div class="col-6">
<!-- Session -->
<label for="fixpass" class="form-label">Areafix Password</label>
<div class="input-group has-validation">
<span class="input-group-text"><i class="bi bi-card-text"></i></span>
@ -74,8 +91,8 @@
</div>
</div>
<!-- TIC -->
<div class="col-5">
<!-- Packet -->
<label for="ticpass" class="form-label">TIC Password</label>
<div class="input-group has-validation">
<span class="input-group-text"><i class="bi bi-archive"></i></span>

View File

@ -1,5 +1,5 @@
<!-- $o=System::class -->
<form class="needs-validation" method="post" autocomplete="off" novalidate>
<form class="needs-validation" method="post" novalidate>
@csrf
<input type="hidden" name="system_id" value="{{ $o->id }}">

View File

@ -1,15 +1,13 @@
<!-- $o=System::class -->
@use(Carbon\Carbon)
@use(Carbon\CarbonInterface)
@use(Illuminate\Support\Facades\Gate)
@use(App\Classes\FTN\Packet)
@use(App\Models\Mailer)
@use(App\Models\User)
<!-- $o=System::class -->
<div class="row">
<div class="col-xl-9 col-12">
<div class="row pt-0">
@can('admin')
@can('admin',$o)
<div class="row pt-0">
<div class="col-12">
<h4 class="mb-0 pb-2">System Users</h4>
@ -21,7 +19,7 @@
<span class="input-group-text"><i class="bi bi-people-fill"></i></span>
<select style="width: 80%;" class="form-select @error('users') is-invalid @enderror" id="users" name="users[]">
<option value="">&nbsp;</option>
@foreach (User::select(['id','name','email'])->orderBy('name')->active()->get() as $uo)
@foreach (User::orderBy('name')->active()->get() as $uo)
<option value="{{ $uo->id }}" @selected(in_array($uo->id,old('users',$o->users->pluck('id')->toArray())))>{{ $uo->name }} <small>({{ $uo->email }})</small></option>
@endforeach
</select>
@ -35,10 +33,10 @@
</div>
</div>
</div>
@endcan
</div>
</div>
@endcan
<div class="row @can('admin')pt-4 @else pt-0 @endcannot">
<div class="row pt-4">
<div class="col-12">
<h4 class="mb-0 pb-2">System Details</h4>
@ -48,7 +46,9 @@
<label for="name" class="form-label">BBS Name</label>
<div class="input-group has-validation">
<span class="input-group-text"><i class="bi bi-pc"></i></span>
<input type="text" class="form-control @error('name') is-invalid @enderror" id="name" placeholder="Name" name="name" value="{{ old('name',$o->name) }}" required @cannot($action,$o)readonly @endcannot autofocus autocomplete="off" data-1p-ignore>
<input type="text" class="form-control @error('name') is-invalid @enderror" id="name" placeholder="Name" name="name" value="{{ old('name',$o->name) }}" required @cannot($action,$o)readonly @endcannot autofocus>
<span id="search-icon" style="width: 0;"><i style="border-radius: 50%;" class="spinner-border spinner-border-sm text-dark d-none"></i></span>
<div id="system_search_results"></div>
<span class="invalid-feedback" role="alert">
@error('name')
{{ $message }}
@ -116,7 +116,7 @@
<label for="address" class="form-label">Mailer Internet Hostname</label>
<div class="input-group has-validation">
<span class="input-group-text"><i class="bi bi-globe"></i></span>
<input type="text" class="w-75 form-control @error('address') is-invalid @enderror" id="address" placeholder="FQDN" name="address" value="{{ old('address',$o->address) }}" @cannot($action,$o)readonly @endcannot data-1p-ignore>
<input type="text" class="w-75 form-control @error('address') is-invalid @enderror" id="address" placeholder="FQDN" name="address" value="{{ old('address',$o->address) }}" @cannot($action,$o)readonly @endcannot>
<span class="invalid-feedback" role="alert">
@error('address')
{{ $message }}
@ -174,7 +174,20 @@
<!-- Mail Packet -->
<div class="col-4">
<x-form.select name="pkt_type" icon="bi-ui-radios" label="Mail Packet" feedback="Set a packet type" :value="$o->pkt_type ?: config('fido.packet_default')" :options="collect(Packet::PACKET_TYPES)->map(fn($item,$key)=>['id'=>$key,'value'=>$key])" required :disabled="Gate::denies('update_nn',$o)"/>
<label for="pkt_type" class="form-label">Mail Packet</label>
<div class="input-group">
<span class="input-group-text"><i class="bi bi-ui-radios"></i></span>
<select class="form-select @error('pkt_type') is-invalid @enderror" id="pkt_type" name="pkt_type" @cannot($action,$o)disabled @endcannot>
@foreach (Packet::PACKET_TYPES as $type => $class)
<option value="{{ $type }}" @if(old('pkt_type',$o->pkt_type ?: config('fido.packet_default')) === $type)selected @endif>{{ $type }}</option>
@endforeach
</select>
<span class="invalid-feedback" role="alert">
@error('pkt_type')
{{ $message }}
@enderror
</span>
</div>
</div>
<!-- Packet Msgs -->
@ -201,9 +214,17 @@
<div class="row pt-0">
<div class="col-4">
<x-form.select name="method" icon="bi-wifi" label="Connection Method" :value="$o->method" :options="collect([['id'=>23,'value'=>'Telnet'],['id'=>22,'value'=>'SSH'],['id'=>519,'value'=>'Rlogin']])" :disabled="Gate::denies('update_nn',$o)"/>
<label for="method" class="form-label">Connection Method</label>
<div class="input-group">
<span class="input-group-text"><i class="bi bi-wifi"></i></span>
<select class="form-select @error('method') is-invalid @enderror" id="method" name="method" @cannot($action,$o)disabled @endcannot>
<option></option>
<option value="23" @if(old('method',$o->method) == 23)selected @endif>Telnet</option>
<option value="22" @if(old('method',$o->method) == 22)selected @endif>SSH</option>
<option value="519" @if(old('method',$o->method) == 519)selected @endif>Rlogin</option>
</select>
</div>
</div>
<div class="col-3">
<label for="method" class="form-label">Port</label>
<div class="input-group">
@ -282,30 +303,28 @@
<div class="row">
<div class="col-12">
<div class="row p-0">
@if($o->exists)
@can('update_nn',$o)
<div class="col-6">
<label for="autohold" class="form-label">Auto Hold</label>
<div class="input-group">
<button id="autohold" @class(['btn','btn-warning'=>$o->autohold,'btn-outline-success'=>(! $o->autohold)])><i @class(['bi-toggle-on'=>$o->autohold,'bi-toggle-off'=>(! $o->autohold)])></i></button>
</div>
@can('update_nn',$o)
<div class="col-6">
<label for="autohold" class="form-label">Auto Hold</label>
<div class="input-group">
<button id="autohold" @class(['btn','btn-warning'=>$o->autohold,'btn-outline-success'=>(! $o->autohold)])><i @class(['bi-toggle-on'=>$o->autohold,'bi-toggle-off'=>(! $o->autohold)])></i></button>
</div>
</div>
<!-- @todo This is only relevant for uplinks, so hide it if this system isnt an uplink -->
<div class="col-6 @if((old('pollmode') === "0") || is_null($o->pollmode))d-none @endif" id="heartbeat_option">
<label for="heartbeat" class="form-label">Heartbeat <i class="bi bi-info-circle" title="Attempt contact after last seen"></i></label>
<div class="input-group has-validation">
<span class="input-group-text"><i class="bi bi-hourglass-bottom"></i></span>
<input type="text" class="form-control text-end @error('heartbeat') is-invalid @enderror" id="heartbeat" placeholder="Hrs" name="heartbeat" value="{{ old('heartbeat',$o->heartbeat) }}">
<span class="invalid-feedback" role="alert">
@error('heartbeat')
{{ $message }}
@enderror
</span>
</div>
<!-- @todo This is only relevant for uplinks, so hide it if this system isnt an uplink -->
<div class="col-6 @if((old('pollmode') === "0") || is_null($o->pollmode))d-none @endif" id="heartbeat_option">
<label for="heartbeat" class="form-label">Heartbeat <i class="bi bi-info-circle" title="Attempt contact after last seen"></i></label>
<div class="input-group has-validation">
<span class="input-group-text"><i class="bi bi-hourglass-bottom"></i></span>
<input type="text" class="form-control text-end @error('heartbeat') is-invalid @enderror" id="heartbeat" placeholder="Hrs" name="heartbeat" value="{{ old('heartbeat',$o->heartbeat) }}">
<span class="invalid-feedback" role="alert">
@error('heartbeat')
{{ $message }}
@enderror
</span>
</div>
@endcan
@endif
</div>
@endcan
</div>
@if(! is_null($o->pollmode))
@ -399,7 +418,7 @@
</div>
</div>
@can('admin')
@can('admin',$o)
<div class="row">
<!-- Notes -->
<div class="col-12">
@ -425,15 +444,15 @@
</div>
</div>
@section('page-css')
@css('select2')
@append
@section('page-scripts')
@js('select2')
<script type="text/javascript">
$(document).ready(function() {
$('#users').select2({
theme: 'bootstrap-5',
dropdownAutoWidth: true,
width: 'style',
allowClear: true,
placeholder: '',
@cannot('admin')disabled: true @endcannot
/*multiple: true*/
});
@ -447,59 +466,57 @@
$('#poll_hold').on('click',function() {
$('#heartbeat_option').addClass('d-none');
})
@if($o->exists)
$("#autohold").on('click',function(item) {
var that = $(this)
var icon = that.find('i');
$("#autohold").on('click',function(item) {
var that = $(this)
var icon = that.find('i');
if (icon.hasClass('bi-toggle-on')) {
$.ajax({
url: '/system/api/autohold/off',
type: 'POST',
dataType: 'json',
data : {id: {{ $o->id }}},
beforeSend: function() {
icon.addClass('spinner-grow spinner-grow-sm')
},
complete: function() {
icon.removeClass('spinner-grow spinner-grow-sm')
},
success: function(data) {
icon.removeClass('bi-toggle-on')
.addClass('bi-toggle-off')
if (icon.hasClass('bi-toggle-on')) {
$.ajax({
url: '/system/api/autohold/off',
type: 'POST',
dataType: 'json',
data : {id: {{ $o->id }}},
beforeSend: function() {
icon.addClass('spinner-grow spinner-grow-sm')
},
complete: function() {
icon.removeClass('spinner-grow spinner-grow-sm')
},
success: function(data) {
icon.removeClass('bi-toggle-on')
.addClass('bi-toggle-off')
that.removeClass('btn-warning')
.addClass('btn-outline-success')
},
cache: false
});
that.removeClass('btn-warning')
.addClass('btn-outline-success')
},
cache: false
});
} else {
$.ajax({
url: '/system/api/autohold/on',
type: 'POST',
dataType: 'json',
data : {id: {{ $o->id }}},
beforeSend: function() {
icon.addClass('spinner-grow spinner-grow-sm')
},
complete: function() {
icon.removeClass('spinner-grow spinner-grow-sm')
},
success: function(data) {
icon.removeClass('bi-toggle-off')
.addClass('bi-toggle-on');
} else {
$.ajax({
url: '/system/api/autohold/on',
type: 'POST',
dataType: 'json',
data : {id: {{ $o->id }}},
beforeSend: function() {
icon.addClass('spinner-grow spinner-grow-sm')
},
complete: function() {
icon.removeClass('spinner-grow spinner-grow-sm')
},
success: function(data) {
icon.removeClass('bi-toggle-off')
.addClass('bi-toggle-on');
that.removeClass('btn-outline-success')
.addClass('btn-warning')
},
cache: false
});
}
that.removeClass('btn-outline-success')
.addClass('btn-warning')
},
cache: false
});
}
return false;
})
@endif
return false;
})
})
</script>
@append

View File

@ -6,7 +6,7 @@
@endsection
@section('content')
<form class="needs-validation" method="post" autocomplete="off" novalidate>
<form class="needs-validation" method="post" novalidate>
@csrf
<div class="row">
@ -48,7 +48,21 @@
<!-- Forward Netmail -->
@can('admin',$o)
<div class="col-4">
<x-form.select name="system_id" icon="bi-envelope-at-fill" label="Forward Netmails" placeholder="Select System" :value="$o->system_id" :options="$o->systems->map(fn($item)=>['id'=>$item->id,'value'=>$item->name])"/>
<label for="system_id" class="form-label">Forward Netmails</label>
<div class="input-group has-validation">
<span class="input-group-text"><i class="bi bi-envelope-at-fill"></i></span>
<select style="width: 80%;" class="form-select @error('system_id') is-invalid @enderror" id="system_id" name="system_id">
<option value="">&nbsp;</option>
@foreach ($o->systems as $oo)
<option value="{{ $oo->id }}" @if(old('system_id',$o->system_id)==$oo->id)selected @endif>{{ $oo->name }}</option>
@endforeach
</select>
<span class="invalid-feedback" role="alert">
@error('system_id')
{{ $message }}
@enderror
</span>
</div>
</div>
@endcan
</div>
@ -181,6 +195,8 @@
@endsection
@section('page-css')
@css('select2')
<style>
#content h3 {
margin-bottom: 5px;
@ -192,6 +208,8 @@
@append
@section('page-scripts')
@js('select2')
<!-- Passkeys -->
<script type='text/javascript' src='{{ asset('/passkey/passkey.js') }}'></script>
@ -206,6 +224,7 @@
<script type="text/javascript">
$(document).ready(function() {
$('#system_id').select2();
$('#passkey').on('click',function(item) {
if (passkey_debug)
console.log('Passkey: Create Click');

View File

@ -1,14 +1,14 @@
@use(App\Models\Address)
@extends('layouts.app')
@section('htmlheader_title')
Link
@endsection
@section('content')
<form class="needs-validation" method="post" autocomplete="off" novalidate>
<form class="needs-validation" method="post" novalidate>
@csrf
<input type="hidden" id="address_id" name="address_id">
<div class="row">
<div class="col-12">
<div class="greyframe titledbox shadow0xb0">
@ -18,16 +18,29 @@
<div class="row">
<!-- Name -->
<div class="col-5">
@php
$options = Address::select(['addresses.id','addresses.host_id','addresses.node_id','addresses.point_id','addresses.zone_id','systems.name'])
->active()
->join('systems',['systems.id'=>'addresses.system_id'])
->whereRaw('systems.id NOT IN (SELECT system_id FROM "system_user")')
->with(['system','zone'])
->orderBy('systems.name')
->cursor()
@endphp
<x-form.select name="address_id" icon="bi-laptop-fill" label="BBS Address" placeholder="Find your AKA" feedback="AKA is required" helper="Enter your BBS name" value="" :options="$options->map(fn($item)=>['id'=>$item->id,'value'=>sprintf('%s (%s)',$item->name,$item->ftn3d)])" required/>
<label for="system" class="form-label">BBS Name</label>
<div class="input-group has-validation">
<span class="input-group-text"><i class="bi bi-laptop-fill"></i></span>
<select style="width: 80%;" class="form-select @error('system_id') is-invalid @enderror" id="system" name="address_id" required>
<option value="">&nbsp;</option>
@foreach (\App\Models\Address::select(['addresses.id','addresses.host_id','addresses.node_id','addresses.point_id','addresses.zone_id','systems.name'])
->active()
->join('systems',['systems.id'=>'addresses.system_id'])
->whereRaw('systems.id NOT IN (SELECT system_id FROM system_user)')
->with(['zone'])
->orderBy('systems.name')
->get() as $oo)
<option value="{{ $oo->id }}" @if(old('id')===$oo->id)selected @endif>{{ $oo->name }} ({{ $oo->ftn3d }})</option>
@endforeach
</select>
<span class="invalid-feedback" role="alert">
@error('system_id')
{{ $message }}
@else
BBS Name is required.
@enderror
</span>
</div>
</div>
</div>
@ -59,4 +72,18 @@
</div>
</div>
</form>
@endsection
@section('page-css')
@css('select2')
@append
@section('page-scripts')
@js('select2')
<script type="text/javascript">
$(document).ready(function() {
$('#system').select2({
placeholder: 'Find your Address',
});
});
</script>
@endsection

View File

@ -1,15 +1,16 @@
@use(App\Models\System)
@extends('layouts.app')
@section('htmlheader_title')
Register System
@endsection
@php
use App\Models\System;
@endphp
@section('content')
<form class="needs-validation" method="post" autocomplete="off" novalidate>
@csrf
<input type="hidden" name="action" value="register">
<div class="row">
<div class="col-12">
@ -20,19 +21,33 @@
<div class="row">
<!-- Name -->
<div class="col-4">
@php($options = System::select(['systems.id','systems.name'])
->active()
->where('id','<>',$setup->system_id)
->whereRaw('id NOT IN (SELECT system_id FROM "system_user")')
->cursor())
<x-form.select name="system_id" icon="bi-laptop-fill" label="BBS Name" placeholder="See if your BBS exists, otherwise add it" feedback="BBS Name is required" helper="Enter your BBS name and press NEXT" :addvalues="true" :options="$options->map(fn($item)=>['id'=>$item->id,'value'=>$item->name])" required/>
<label for="system" class="form-label">BBS Name</label>
<div class="input-group has-validation">
<span class="input-group-text"><i class="bi bi-laptop-fill"></i></span>
<select style="width: 80%;" class="form-select @error('system_id') is-invalid @enderror" id="system" name="id" required>
<option value="">&nbsp;</option>
@foreach (System::select(['systems.id','systems.name'])
->active()
->where('id','<>',$setup->system_id)
->whereRaw('id NOT IN (SELECT system_id FROM "system_user")')
->cursor() as $oo)
<option value="{{ $oo->id }}" @if(old('id')===$oo->id)selected @endif>{{ $oo->name }}</option>
@endforeach
</select>
<span class="invalid-feedback" role="alert">
@error('system_id')
{{ $message }}
@else
BBS Name is required.
@enderror
</span>
</div>
</div>
</div>
<div class="row">
<div class="col-12 pb-2">
<button type="submit" class="btn btn-success">Next</button><span id="next" class="m-2"><i class="spinner-border spinner-border-sm text-light d-none"></i></span>
<button type="button" name="submit" class="btn btn-success">Next</button><span id="next" class="m-2"><i class="spinner-border spinner-border-sm text-light d-none"></i></span>
</div>
</div>
</div>
@ -40,4 +55,118 @@
</div>
</div>
</form>
@endsection
<div class="modal fade" id="no-auth" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header bg-danger">
<h5 class="modal-title">ERROR: No authorisation</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<p>It appears that you are not allowed to create this entry.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
@endsection
@section('page-css')
@css('select2')
@append
@section('page-scripts')
@js('select2')
<script type='text/javascript'>
$(document).ready(function() {
$('#system').select2({
placeholder: 'See if your BBS exists',
tags: true,
});
});
</script>
<script type='text/javascript'>
var system_id;
var noauth = new bootstrap.Modal(document.getElementById('no-auth'), {});
function validation(item,message) {
var attr = $('input[id='+item+']');
attr.addClass('is-invalid')
attr.parent().find('.invalid-feedback').empty().append(message);
}
/**
* We have selected a BBS from the link/register form, and it's either a new entry or an existing one
* @param icon
*/
function getform(icon) {
$.ajax({
url : '{{ url('user/system/register') }}',
type : 'POST',
data : { system_id: system_id,name: $('#system').val(),action: 'register',old: {!! json_encode(old()) !!} },
dataType : 'json',
async : true,
cache : false,
beforeSend : function() {
if (icon)
icon.toggleClass('d-none');
},
complete : function(data) {
switch (data.status) {
case 200:
// if json is null, means no match, won't do again.
if(data.responseText===null || (data.responseText.length===0)) return;
$('#create').empty().append(data.responseText);
@if($errors->count())
@foreach($errors->keys() as $key)
validation('{{ $key }}','{{ $errors->first($key) }}');
@endforeach
@endif
break;
case 403:
if (icon)
icon.toggleClass('d-none');
noauth.show();
break;
case 419:
location.reload();
break;
case 422:
validation('name',data.responseJSON.errors.name[0]);
if (icon)
icon.toggleClass('d-none');
break;
default:
return false;
}
}
})
}
if ({{ old('submit') === 'create' ? 'true' : 'false' }}) {
getform();
}
$(document).ready(function() {
$('button[name=submit]').on('click',function() {
icon = $(this).parent().find('i');
if (! $('#system').val())
return;
getform(icon);
})
});
</script>
@append

View File

@ -1,57 +0,0 @@
<!-- $so=System::class -->
@use(App\Models\System)
@extends('layouts.app')
@section('htmlheader_title')
Register System
@endsection
@section('content')
@if(! $so->address)
<h3 class="pt-2">Enable to complete registration</h3>
<p>The system you selected <strong class="highlight">{{ $so->name }}</strong> doesnt have mailer details, please contact that system administration to update those details first</p>
@else
<h3 class="pt-2">System Details:</h3>
<table class="monotable">
<tr>
<th>System</th>
<th>{{ $so->name }}</th>
</tr>
<tr>
<th>Sysop</th>
<th>{{ $so->sysop }}</th>
</tr>
<tr>
<th>Location</th>
<th>{{ $so->location }}</th>
</tr>
<tr>
<th>Networks</th>
<th>{{ $so->akas->pluck('ftn')->join(', ') }}</th>
</tr>
<tr>
<th>Address</th>
<th>{{ $so->access_mailer }}</th>
</tr>
</table>
<p>If the details are above are not correct, then please contact the (ZC) to have them corrected first.</p>
<p>Otherwise, if all is good, we'll send a netmail to <strong class="highlight">{{ $so->sysop }}</strong> at <strong class="highlight">{{ $so->access_mailer }}</strong></p> with further details.
<form class="needs-validation" method="post" autocomplete="off" action="{{ url('user/system/link') }}" novalidate>
@csrf
<input type="hidden" name="system_id" value="{{ $so->id }}">
<input type="hidden" name="name" value="{{ $so->name }}">
<div class="row pb-2">
<div class="col-12">
<input type="submit" name="action" class="btn btn-success" value="Link">
</div>
</div>
</form>
@endif
@endsection

View File

@ -0,0 +1,41 @@
<!-- $o = System::class -->
<h3>System Details:</h3>
<table class="monotable">
<tr>
<th>System</th>
<th>{{ $o->name }}</th>
</tr>
<tr>
<th>Sysop</th>
<th>{{ $o->sysop }}</th>
</tr>
<tr>
<th>Location</th>
<th>{{ $o->location }}</th>
</tr>
<tr>
<th>Networks</th>
<th>{{ $o->akas->pluck('ftn')->join(', ') }}</th>
</tr>
<tr>
<th>Address</th>
<th>{{ $o->access_mailer }}</th>
</tr>
</table>
<p>If the details are above are not correct, then please contact the (ZC) to have them corrected first.</p>
<p>Otherwise, if all is good, we'll send a netmail to <strong class="highlight">{{ $o->sysop }}</strong> at <strong class="highlight">{{ $o->access_mailer }}</strong></p> with further details.
<form class="needs-validation" method="post" autocomplete="off" action="{{ url('user/system/link') }}" novalidate>
@csrf
<input type="hidden" name="system_id" value="{{ $o->id }}">
<input type="hidden" name="name" value="{{ $o->name }}">
<div class="row pb-2">
<div class="col-12">
<input type="submit" name="action" class="btn btn-success" value="Link">
</div>
</div>
</form>

View File

@ -1,7 +1,3 @@
<!-- $o=Zone::class-->
@use(App\Models\Domain)
@use(App\Models\System)
@extends('layouts.app')
@section('htmlheader_title')
@ -9,7 +5,7 @@
@endsection
@section('content')
<form class="needs-validation" method="post" autocomplete="off" novalidate>
<form class="needs-validation" method="post" novalidate>
@csrf
<div class="row">
@ -34,12 +30,24 @@
</div>
<div class="col-3">
@php
$helper = (! $o->domain_id)
? sprintf('Add a <a href="%s">NEW Domain</a>',url('domain/addedit'))
: sprintf('<a href="%s">Edit</a> Domain',url('domain/addedit',[$o->domain_id]));
@endphp
<x-form.select name="domain_id" icon="bi-tag-fill" label="Domain" :helper="$helper" feedback="A domain is required" :value="$o->domain_id" :options="Domain::select(['id','name'])->active()->orderBy('name')->cursor()->map(fn($item)=>['id'=>$item->id,'value'=>$item->name])" required/>
<label for="domain" class="form-label">Domain</label>
<div class="input-group has-validation">
<span class="input-group-text"><i class="bi bi-tag-fill"></i></span>
<select class="form-select @error('domain_id') is-invalid @enderror" id="domain" name="domain_id" required @cannot('admin',$o)disabled @endcannot>
<option value="">&nbsp;</option>
@foreach (\App\Models\Domain::active()->orderBy('name')->cursor() as $oo)
<option value="{{ $oo->id }}" @if(old('domain_id',$o->domain_id)==$oo->id)selected @endif>{{ $oo->name }}</option>
@endforeach
</select>
<span class="invalid-feedback" role="alert">
@error('domain_id')
{{ $message }}
@else
A domain is required.
@enderror
</span>
<span class="input-helper">Add a <a href="{{ url('domain/addedit') }}">NEW Domain</a></span>
</div>
</div>
<div class="offset-1 col-2">
@ -76,12 +84,24 @@
<div class="row">
<div class="col-4">
@php
$helper = (! $o->system_id)
? sprintf('Add a <a href="%s">NEW System</a>',url('system/addedit'))
: sprintf('<a href="%s">Edit</a> System',url('system/addedit',[$o->system_id]));
@endphp
<x-form.select name="system_id" icon="bi-laptop-fill" label="System" feedback="A system is required" :helper="sprintf('%s. This system is the primary mailer/tosser responsible for the zone.',$helper)" :value="$o->system_id" :options="System::select(['id','name'])->active()->orderBy('name')->cursor()->map(fn($item)=>['id'=>$item->id,'value'=>$item->name])" required/>
<label for="system" class="form-label">System</label>
<div class="input-group has-validation">
<span class="input-group-text"><i class="bi bi-laptop-fill"></i></span>
<select style="width: 80%;" class="form-select @error('system_id') is-invalid @enderror" id="system" name="system_id" required @cannot('admin',$o)disabled @endcannot>
<option value="">&nbsp;</option>
@foreach (\App\Models\System::active()->cursor() as $oo)
<option value="{{ $oo->id }}" @if(old('system_id',$o->system_id)==$oo->id)selected @endif>{{ $oo->name }}</option>
@endforeach
</select>
<span class="invalid-feedback" role="alert">
@error('system_id')
{{ $message }}
@else
A system is required.
@enderror
</span>
<span class="input-helper">Add a <a href="{{ url('system/addedit') }}">NEW System</a>. This system is the primary mailer/tosser responsible for managing the zone.</span>
</div>
</div>
</div>
@ -155,4 +175,17 @@
</div>
</div>
</form>
@endsection
@endsection
@section('page-css')
@css('select2')
@append
@section('page-scripts')
@js('select2')
<script type="text/javascript">
$(document).ready(function() {
$('#system').select2();
});
</script>
@append

View File

@ -135,9 +135,7 @@ Route::middleware(['auth','verified','activeuser'])->group(function () {
Route::view('user/system/register','user.system.register');
Route::post('user/system/register',[SystemController::class,'register']);
Route::view('user/system/register_confirm/{so}','user.system.register_confirm')
->where('so','[0-9]+');
Route::post('user/system/link',[SystemController::class,'system_link']);
Route::match(['post'],'user/system/link',[SystemController::class,'system_link']);
/* ZONE PATHS */
Route::view('zone','zone.home');