Rework SystemController methods and paths, no functional changes

This commit is contained in:
Deon George 2023-10-05 22:15:53 +11:00
parent c86d8d8952
commit fda68bba04
22 changed files with 380 additions and 403 deletions

View File

@ -24,6 +24,42 @@ class SystemController extends Controller
{
private const LOGKEY = 'CSC';
/**
* Add or edit a node
*/
public function add_edit(SystemRegister $request,System $o)
{
$this->authorize('update',$o);
if ($request->post()) {
foreach (['name','location','sysop','hold','phone','address','port','active','method','notes','zt_id','pkt_type'] as $key)
$o->{$key} = $request->post($key);
switch ($request->post('pollmode')) {
case 1: $o->pollmode = FALSE; break;
case 2: $o->pollmode = TRUE; break;
default: $o->pollmode = NULL;
}
$o->autohold = FALSE;
$o->save();
$mailers = collect($request->post('mailer_details'))
->filter(function($item) { return $item['port']; })
->transform(function($item) { $item['active'] = Arr::get($item,'active',FALSE); return $item; });
$o->mailers()->sync($mailers);
return redirect()->action([self::class,'home']);
}
$o->load(['addresses.zone.domain','addresses.system','sessions.domain','sessions.systems']);
return view('system.addedit')
->with('action',$o->exists ? 'update' : 'create')
->with('o',$o);
}
/**
* Add an address to a system
*
@ -32,7 +68,7 @@ class SystemController extends Controller
* @return \Illuminate\Http\RedirectResponse
* @throws \Illuminate\Auth\Access\AuthorizationException
*/
public function add_address(Request $request,System $o)
public function address_add(Request $request,System $o)
{
// @todo a point address is failing validation
// @todo This should be admin of the zone
@ -59,12 +95,12 @@ class SystemController extends Controller
->where('point_id',0)
->where('role',Address::NODE_RC);
})
// Check that a host doesnt already exist
->orWhere(function($query) use ($value) {
return $query->where('host_id',$value)
->where('point_id',0)
->where('role',Address::NODE_NC);
});
// Check that a host doesnt already exist
->orWhere(function($query) use ($value) {
return $query->where('host_id',$value)
->where('point_id',0)
->where('role',Address::NODE_NC);
});
if ($o->count()) {
$fail('Region or host already exists');
@ -98,15 +134,15 @@ class SystemController extends Controller
return $query->where('region_id',$value)
->where('role',Address::NODE_RC);
})
// Check that a host doesnt already exist
->orWhere(function($query) use ($value) {
return $query->where('host_id',$value)
->where('role',Address::NODE_NC);
});
// Check that a host doesnt already exist
->orWhere(function($query) use ($value) {
return $query->where('host_id',$value)
->where('role',Address::NODE_NC);
});
})
->where('zone_id',$request->post('zone_id'))
->where('point_id',0)
->where('active',TRUE);
->where('zone_id',$request->post('zone_id'))
->where('point_id',0)
->where('active',TRUE);
if ($o->count()) {
$fail('Region or host already exists');
@ -242,78 +278,51 @@ class SystemController extends Controller
return redirect()->back()->withErrors(['action'=>'Unknown action: '.$request->post('action')]);
}
return redirect()->to(sprintf('ftn/system/addedit/%d',$o->id));
return redirect()->to(sprintf('system/addedit/%d',$o->id));
}
/**
* Add Session details
* Delete address assigned to a host
*
* @param Request $request
* @param System $o
* @param Address $o
* @return \Illuminate\Http\RedirectResponse
* @throws \Illuminate\Auth\Access\AuthorizationException
*/
public function add_session(Request $request,System $o)
public function address_del(Address $o)
{
// @todo This should be admin of the zone
$this->authorize('update',$o);
session()->flash('accordion','session');
$this->authorize('admin',$o);
session()->flash('accordion','address');
$validate = $request->validate([
'zone_id' => 'required|exists:zones,id',
'sespass' => 'required|string|min:4',
'pktpass' => 'required|string|min:4|max:8',
'ticpass' => 'required|string|min:4',
'fixpass' => 'required|string|min:4',
]);
$sid = $o->system_id;
$o->active = FALSE;
$o->save();
$o->delete();
$zo = Zone::findOrFail($validate['zone_id']);
// If this session is for the ZC, it now becomes the default.
if ($o->match($zo,Address::NODE_ZC)->count()) {
SystemZone::where('default',TRUE)->update(['default'=>FALSE]);
$validate['default'] = TRUE;
}
$o->sessions()->attach($zo,$validate);
return redirect()->to(sprintf('ftn/system/addedit/%d',$o->id));
return redirect()->to(sprintf('system/addedit/%d',$sid));
}
/**
* Add or edit a node
* Demote an address NC -> node
*
* @param Address $o
* @return \Illuminate\Http\RedirectResponse
* @throws \Illuminate\Auth\Access\AuthorizationException
*/
public function add_edit(SystemRegister $request,System $o)
public function address_dem(Address $o)
{
$this->authorize('update',$o);
// @todo This should be admin of the zone
$this->authorize('admin',$o);
session()->flash('accordion','address');
if ($request->post()) {
foreach (['name','location','sysop','hold','phone','address','port','active','method','notes','zt_id','pkt_type'] as $key)
$o->{$key} = $request->post($key);
// Make sure that no other system has this address active.
if ($o->role === Address::NODE_ACTIVE)
return redirect()->back()->withErrors(['demaddress'=>sprintf('%s cannot be demoted any more',$o->ftn3D)]);
switch ($request->post('pollmode')) {
case 1: $o->pollmode = FALSE; break;
case 2: $o->pollmode = TRUE; break;
default: $o->pollmode = NULL;
}
$o->role = ($o->role << 1);
$o->save();
$o->autohold = FALSE;
$o->save();
$mailers = collect($request->post('mailer_details'))
->filter(function($item) { return $item['port']; })
->transform(function($item) { $item['active'] = Arr::get($item,'active',FALSE); return $item; });
$o->mailers()->sync($mailers);
return redirect()->action([self::class,'home']);
}
$o->load(['addresses.zone.domain','addresses.system','sessions.domain','sessions.systems']);
return view('system.addedit')
->with('action',$o->exists ? 'update' : 'create')
->with('o',$o);
return redirect()->to(sprintf('system/addedit/%d',$o->system_id));
}
public function address_merge(AddressMerge $request,int $id)
@ -400,6 +409,146 @@ class SystemController extends Controller
->with('oo',$oo);
}
/**
* Move address to another system
*
* @param Request $request
* @param System $so
* @param Address $o
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View|\Illuminate\Http\RedirectResponse
* @throws \Illuminate\Auth\Access\AuthorizationException
*/
public function address_mov(Request $request,System $so,Address $o)
{
session()->flash('accordion','address');
// Quick check that this address belongs to this system
if ($so->addresses->search(function($item) use ($o) { return $item->id === $o->id; }) === FALSE)
abort(404);
if ($request->post()) {
$this->authorize('admin',$o);
$validated = $request->validate([
'system_id' => 'required|exists:systems,id',
'remove' => 'nullable|boolean',
'remsess' => 'nullable|boolean|exclude_if:remove,1',
]);
$o->system_id = $validated['system_id'];
$o->save();
if (Arr::get($validated,'remove')) {
$so->sessions()->detach($o->zone);
$so->mailers()->detach();
$so->users()->detach();
$so->delete();
} elseif (Arr::get($validated,'remsess')) {
$so->sessions()->detach($o->zone);
}
return redirect()->to('system/addedit/'.$validated['system_id']);
}
return view('system.moveaddr')
->with('o',$o);
}
/**
* Promote an address node -> NC
*
* @param Address $o
* @return \Illuminate\Http\RedirectResponse
* @throws \Illuminate\Auth\Access\AuthorizationException
*/
public function address_pro(Address $o)
{
// @todo This should be admin of the zone
$this->authorize('admin',$o);
session()->flash('accordion','address');
// Make sure that no other system has this address active.
if ($o->role === Address::NODE_NC)
return redirect()->back()->withErrors(['proaddress'=>sprintf('%s cannot be promoted any more',$o->ftn3D)]);
$o->role = ($o->role >> 1);
$o->save();
return redirect()->to(sprintf('system/addedit/%d',$o->system_id));
}
/**
* Recover a deleted address
*
* @param int $id
* @return \Illuminate\Http\RedirectResponse
* @throws \Illuminate\Auth\Access\AuthorizationException
*/
public function address_pur(int $id)
{
$o = Address::onlyTrashed()->findOrFail($id);
// @todo This should be admin of the zone
$this->authorize('admin',$o);
session()->flash('accordion','address');
$o->forceDelete();
return redirect()->to(sprintf('system/addedit/%d',$o->system_id));
}
/**
* Recover a deleted address
*
* @param int $id
* @return \Illuminate\Http\RedirectResponse
* @throws \Illuminate\Auth\Access\AuthorizationException
*/
public function address_rec(int $id)
{
$o = Address::onlyTrashed()->findOrFail($id);
// @todo This should be admin of the zone
$this->authorize('admin',$o);
session()->flash('accordion','address');
$o->restore();
return redirect()->to(sprintf('system/addedit/%d',$o->system_id));
}
/**
* Suspend address assigned to a host
*
* @param Address $o
* @return \Illuminate\Http\RedirectResponse
* @throws \Illuminate\Auth\Access\AuthorizationException
*/
public function address_sus(Address $o)
{
// @todo This should be admin of the zone
$this->authorize('admin',$o);
session()->flash('accordion','address');
// Make sure that no other system has this address active.
if (! $o->active && ($x=Address::where([
'zone_id'=>$o->zone_id,
'host_id'=>$o->host_id,
'node_id'=>$o->node_id,
'point_id'=>$o->point_id,
'active'=>TRUE,
])->single())) {
return redirect()->back()->withErrors(['susaddress'=>sprintf('%s is already active on system [<a href="%s">%s</a>]',$o->ftn,url('system/addedit',$x->system_id),$x->system->name)]);
}
$o->active = (! $o->active);
$o->save();
return redirect()->to(sprintf('system/addedit/%d',$o->system_id));
}
public function api_address(Request $request,System $o): Collection
{
return Address::select(['addresses.id','addresses.zone_id','region_id','host_id','node_id','point_id'])
@ -417,26 +566,13 @@ class SystemController extends Controller
return $o;
}
/**
* Systems with no owners
*/
public function api_orphan(Request $request): Collection
{
return System::select(['id','name'])
->leftjoin('system_user',['system_user.system_id'=>'systems.id'])
->whereNull('user_id')
->where('systems.name','ilike','%'.$request->term.'%')
->orderBy('name')
->get();
}
/**
* Identify all the addresses from systems that are not owned by a user
*
* @param Request $request
* @return Collection
*/
public function api_orphan_address(Request $request): Collection
public function api_address_orphan(Request $request): Collection
{
$result = collect();
@ -497,67 +633,6 @@ class SystemController extends Controller
->with('setup',Setup::findOrFail(config('app.id')));
}
/**
* Delete address assigned to a host
*
* @param Address $o
* @return \Illuminate\Http\RedirectResponse
* @throws \Illuminate\Auth\Access\AuthorizationException
*/
public function del_address(Address $o)
{
// @todo This should be admin of the zone
$this->authorize('admin',$o);
session()->flash('accordion','address');
$sid = $o->system_id;
$o->active = FALSE;
$o->save();
$o->delete();
return redirect()->to(sprintf('ftn/system/addedit/%d',$sid));
}
/**
* Demo an address NC -> node
*
* @param Address $o
* @return \Illuminate\Http\RedirectResponse
* @throws \Illuminate\Auth\Access\AuthorizationException
*/
public function dem_address(Address $o)
{
// @todo This should be admin of the zone
$this->authorize('admin',$o);
session()->flash('accordion','address');
// Make sure that no other system has this address active.
if ($o->role === Address::NODE_ACTIVE)
return redirect()->back()->withErrors(['demaddress'=>sprintf('%s cannot be demoted any more',$o->ftn3D)]);
$o->role = ($o->role << 1);
$o->save();
return redirect()->to(sprintf('ftn/system/addedit/%d',$o->system_id));
}
/**
* Delete address assigned to a host
*
* @param Address $o
* @return \Illuminate\Http\RedirectResponse
* @throws \Illuminate\Auth\Access\AuthorizationException
*/
public function del_session(System $o,Zone $zo)
{
$this->authorize('admin',$zo);
session()->flash('accordion','session');
$o->sessions()->detach($zo);
return redirect()->to(sprintf('ftn/system/addedit/%d',$o->id));
}
/**
* Update the systems echoareas
*
@ -641,186 +716,10 @@ class SystemController extends Controller
->with('fileareas',$fo);
}
public function home()
{
return view('system.home');
}
/**
* Move address to another system
*
* @param Request $request
* @param System $so
* @param Address $o
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View|\Illuminate\Http\RedirectResponse
* @throws \Illuminate\Auth\Access\AuthorizationException
*/
public function mov_address(Request $request,System $so,Address $o)
{
session()->flash('accordion','address');
// Quick check that this address belongs to this system
if ($so->addresses->search(function($item) use ($o) { return $item->id === $o->id; }) === FALSE)
abort(404);
if ($request->post()) {
$this->authorize('admin',$o);
$validated = $request->validate([
'system_id' => 'required|exists:systems,id',
'remove' => 'nullable|boolean',
'remsess' => 'nullable|boolean|exclude_if:remove,1',
]);
$o->system_id = $validated['system_id'];
$o->save();
if (Arr::get($validated,'remove')) {
$so->sessions()->detach($o->zone);
$so->mailers()->detach();
$so->users()->detach();
$so->delete();
} elseif (Arr::get($validated,'remsess')) {
$so->sessions()->detach($o->zone);
}
return redirect()->to('ftn/system/addedit/'.$validated['system_id']);
}
return view('system.moveaddr')
->with('o',$o);
}
public function ours()
{
return view('system.ours');
}
/**
* Promote an address node -> NC
*
* @param Address $o
* @return \Illuminate\Http\RedirectResponse
* @throws \Illuminate\Auth\Access\AuthorizationException
*/
public function pro_address(Address $o)
{
// @todo This should be admin of the zone
$this->authorize('admin',$o);
session()->flash('accordion','address');
// Make sure that no other system has this address active.
if ($o->role === Address::NODE_NC)
return redirect()->back()->withErrors(['proaddress'=>sprintf('%s cannot be promoted any more',$o->ftn3D)]);
$o->role = ($o->role >> 1);
$o->save();
return redirect()->to(sprintf('ftn/system/addedit/%d',$o->system_id));
}
/**
* Suspend address assigned to a host
*
* @param Address $o
* @return \Illuminate\Http\RedirectResponse
* @throws \Illuminate\Auth\Access\AuthorizationException
*/
public function sus_address(Address $o)
{
// @todo This should be admin of the zone
$this->authorize('admin',$o);
session()->flash('accordion','address');
// Make sure that no other system has this address active.
if (! $o->active && ($x=Address::where([
'zone_id'=>$o->zone_id,
'host_id'=>$o->host_id,
'node_id'=>$o->node_id,
'point_id'=>$o->point_id,
'active'=>TRUE,
])->single())) {
return redirect()->back()->withErrors(['susaddress'=>sprintf('%s is already active on system [<a href="%s">%s</a>]',$o->ftn,url('ftn/system/addedit',$x->system_id),$x->system->name)]);
}
$o->active = (! $o->active);
$o->save();
return redirect()->to(sprintf('ftn/system/addedit/%d',$o->system_id));
}
/**
* Recover a deleted address
*
* @param int $id
* @return \Illuminate\Http\RedirectResponse
* @throws \Illuminate\Auth\Access\AuthorizationException
*/
public function rec_address(int $id)
{
$o = Address::onlyTrashed()->findOrFail($id);
// @todo This should be admin of the zone
$this->authorize('admin',$o);
session()->flash('accordion','address');
$o->restore();
return redirect()->to(sprintf('ftn/system/addedit/%d',$o->system_id));
}
/**
* Recover a deleted address
*
* @param int $id
* @return \Illuminate\Http\RedirectResponse
* @throws \Illuminate\Auth\Access\AuthorizationException
*/
public function pur_address(int $id)
{
$o = Address::onlyTrashed()->findOrFail($id);
// @todo This should be admin of the zone
$this->authorize('admin',$o);
session()->flash('accordion','address');
$o->forceDelete();
return redirect()->to(sprintf('ftn/system/addedit/%d',$o->system_id));
}
// @todo Can this be consolidated with system_register()
public function system_link(Request $request)
{
if (! $request->system_id)
return redirect('user/system/register');
$s = Setup::findOrFail(config('app.id'))->system;
$so = System::findOrFail($request->system_id);
$ca = NULL;
$la = NULL;
foreach ($s->akas as $ao) {
if (($ca=$so->match($ao->zone))->count())
break;
}
if ($ca->count() && $la=$ca->pop()) {
Notification::route('netmail',$la)->notify(new AddressLink(Auth::user()));
AddressPoll::dispatch($la)->delay(15);
}
return view('user.system.register_send')
->with('la',$la)
->with('o',$so);
}
/**
* Register a system, or link to an existing system
*/
public function system_register(SystemRegister $request)
public function register(SystemRegister $request)
{
// Step 1, show the user a form to select an existing defined system
if ($request->isMethod('GET'))
@ -863,7 +762,7 @@ class SystemController extends Controller
// @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('ftn/system/addedit',$o->id));
return redirect()->to(url('system/addedit',$o->id));
}
// Re-flash our previously input data
@ -876,6 +775,84 @@ class SystemController extends Controller
->with('errors',new ViewErrorBag);
}
/**
* Add Session details
*
* @param Request $request
* @param System $o
* @return \Illuminate\Http\RedirectResponse
* @throws \Illuminate\Auth\Access\AuthorizationException
*/
public function session_add(Request $request,System $o)
{
// @todo This should be admin of the zone
$this->authorize('update',$o);
session()->flash('accordion','session');
$validate = $request->validate([
'zone_id' => 'required|exists:zones,id',
'sespass' => 'required|string|min:4',
'pktpass' => 'required|string|min:4|max:8',
'ticpass' => 'required|string|min:4',
'fixpass' => 'required|string|min:4',
]);
$zo = Zone::findOrFail($validate['zone_id']);
// If this session is for the ZC, it now becomes the default.
if ($o->match($zo,Address::NODE_ZC)->count()) {
SystemZone::where('default',TRUE)->update(['default'=>FALSE]);
$validate['default'] = TRUE;
}
$o->sessions()->attach($zo,$validate);
return redirect()->to(sprintf('system/addedit/%d',$o->id));
}
/**
* Delete address assigned to a host
*
* @param Address $o
* @return \Illuminate\Http\RedirectResponse
* @throws \Illuminate\Auth\Access\AuthorizationException
*/
public function session_del(System $o,Zone $zo)
{
$this->authorize('admin',$zo);
session()->flash('accordion','session');
$o->sessions()->detach($zo);
return redirect()->to(sprintf('system/addedit/%d',$o->id));
}
// @todo Can this be consolidated with system_register()
public function system_link(Request $request)
{
if (! $request->system_id)
return redirect('user/system/register');
$s = Setup::findOrFail(config('app.id'))->system;
$so = System::findOrFail($request->system_id);
$ca = NULL;
$la = NULL;
foreach ($s->akas as $ao) {
if (($ca=$so->match($ao->zone))->count())
break;
}
if ($ca->count() && $la=$ca->pop()) {
Notification::route('netmail',$la)->notify(new AddressLink(Auth::user()));
AddressPoll::dispatch($la)->delay(15);
}
return view('user.system.register_send')
->with('la',$la)
->with('o',$so);
}
public function view(System $o)
{
$o->load(['addresses']);

View File

@ -23,7 +23,7 @@
<tbody>
@foreach ($user->systems as $o)
<tr>
<th><a href="{{ url('ftn/system/addedit',[$o->id]) }}">{{ $o->name }}</a></th>
<th><a href="{{ url('system/addedit',[$o->id]) }}">{{ $o->name }}</a></th>
<th class="text-end">{!! $o->akas->pluck('ftn')->join('<br>') !!}</th>
</tr>
@endforeach
@ -41,7 +41,7 @@
<tbody>
@foreach ($user->systems as $o)
<tr>
<th><a href="{{ url('ftn/system/addedit',[$o->id]) }}">{{ $o->name }}</a></th>
<th><a href="{{ url('system/addedit',[$o->id]) }}">{{ $o->name }}</a></th>
<th class="text-end">{!! $o->addresses->pluck('zone.domain.echoareas')->flatten()->pluck('name')->unique()->sort()->join(', ') !!}</th>
</tr>
@endforeach

View File

@ -126,7 +126,7 @@
@foreach ($o->zones->sortBy('zone_id') as $oz)
@foreach ($oz->addresses as $ao)
<tr>
<td><a href="{{ url('ftn/system/addedit',[$ao->system_id]) }}">{{ $ao->system->full_name($ao) }}</a> @auth<span class="float-end"><small>@if($ao->session('sespass'))<sup>{{ $ao->session('default') ? '**' : '*' }}</sup>@elseif($ao->system->setup)<sup class="success">+</sup>@endif[{{ $ao->system_id }}]</small></span>@endauth</td>
<td><a href="{{ url('system/addedit',[$ao->system_id]) }}">{{ $ao->system->full_name($ao) }}</a> @auth<span class="float-end"><small>@if($ao->session('sespass'))<sup>{{ $ao->session('default') ? '**' : '*' }}</sup>@elseif($ao->system->setup)<sup class="success">+</sup>@endif[{{ $ao->system_id }}]</small></span>@endauth</td>
<td>{{ $ao->system->sysop }}</td>
<td>{{ $ao->system->location }}</td>
<td>{{ $ao->ftn4d }}</td>

View File

@ -178,7 +178,7 @@
<tbody>
@foreach ($o->addresses as $ao)
<tr>
<td><a href="{{ url('ftn/system/addedit',[$ao->system_id]) }}">{{ $ao->system->full_name($ao) }}</a> @auth<span class="float-end"><small>@if($ao->session('sespass'))<sup>{{ $ao->session('default') ? '**' : '*' }}</sup>@elseif($ao->system->setup)<sup class="success">+</sup>@endif[{{ $ao->system_id }}]</small></span>@endauth</td>
<td><a href="{{ url('system/addedit',[$ao->system_id]) }}">{{ $ao->system->full_name($ao) }}</a> @auth<span class="float-end"><small>@if($ao->session('sespass'))<sup>{{ $ao->session('default') ? '**' : '*' }}</sup>@elseif($ao->system->setup)<sup class="success">+</sup>@endif[{{ $ao->system_id }}]</small></span>@endauth</td>
<td>{{ $ao->ftn_3d }}</td>
<td>{{ $ao->system->last_session ? $ao->system->last_session->format('Y-m-d H:i') : '-' }}</td>
<td>{{ ($x=$o->waiting($ao))->count() ? $x->first()->datetime->format('Y-m-d H:i') : '-' }}</td>

View File

@ -5,7 +5,7 @@
<dl>
<dt>My Systems</dt>
@foreach ($user->systems->sortBy('name') as $o)
<dd><a href="{{ url('ftn/system/addedit',['id'=>$o->id]) }}">{{ $o->name }}</a></dd>
<dd><a href="{{ url('system/addedit',['id'=>$o->id]) }}">{{ $o->name }}</a></dd>
@endforeach
</dl>
@endauth
@ -26,7 +26,7 @@
<dl>
<dt>Network Admin</dt>
<dd><a href="{{ url('ftn/domain') }}">Domains</a></dd>
<dd><a href="{{ url('ftn/system') }}">Systems</a></dd>
<dd><a href="{{ url('system') }}">Systems</a></dd>
<dd><a href="{{ url('ftn/zone') }}">Zones</a></dd>
<dd><a href="{{ url('ftn/echoarea') }}">Echoareas</a></dd>
<dd><a href="{{ url('ftn/filearea') }}">Fileareas</a></dd>
@ -34,7 +34,7 @@
<dl>
<dt>System Admin</dt>
<dd><a href="{{ url('ftn/our_systems') }}">This Host Systems</a></dd>
<dd><a href="{{ url('system/ours') }}">This Host Systems</a></dd>
</dl>
@endif

View File

@ -45,9 +45,9 @@ use App\Classes\Protocol\{Binkp,EMSI,DNS};
</span>
<span class="input-helper">
@if(! $o->system_id)
Add a <a href="{{ url('ftn/system/addedit') }}">NEW System</a>
Add a <a href="{{ url('system/addedit') }}">NEW System</a>
@else
<a href="{{ url('ftn/system/addedit',[$o->system_id]) }}">Edit</a> System
<a href="{{ url('system/addedit',[$o->system_id]) }}">Edit</a> System
@endif
</span>
</div>

View File

@ -118,18 +118,18 @@
<!-- No options -->
<a href="javascript:;" title="Net Disabled"><i class="bi bi-slash-square"></i></a>
@elseif($oo->trashed())
<a href="{{ url('ftn/system/recaddress',[$oo->id]) }}" title="Restore Address"><i class="bi bi-bandaid"></i></a>
<a href="{{ url('ftn/system/puraddress',[$oo->id]) }}" title="Purge Address" class="purge"><i class="bi bi-scissors"></i></a>
<a href="{{ url('system/address/rec',[$oo->id]) }}" title="Restore Address"><i class="bi bi-bandaid"></i></a>
<a href="{{ url('system/address/pur',[$oo->id]) }}" title="Purge Address" class="purge"><i class="bi bi-scissors"></i></a>
@else
<a href="{{ url('ftn/system/modaddress',[$oo->id]) }}" data-id="{{ $oo->id }}" title="Modify Address" class="modaddress" aria-readonly="true"><i class="bi bi-pencil-square"></i></a>
<a href="{{ url('ftn/system/susaddress',[$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('ftn/system/movaddress',[$o->id,$oo->id]) }}" title="Move Address to another System"><i class="bi bi-arrow-right-square"></i></a>
<a href="{{ url('ftn/system/deladdress',[$oo->id]) }}" title="Delete Address"><i class="bi bi-trash"></i></a>
<a href="{{ url('system/address/mod',[$oo->id]) }}" data-id="{{ $oo->id }}" title="Modify Address" class="modaddress" aria-readonly="true"><i class="bi bi-pencil-square"></i></a>
<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 ((\App\Models\Address::NODE_HC|\App\Models\Address::NODE_ACTIVE) & $oo->role)
<a href="{{ url('ftn/system/proaddress',[$oo->id]) }}" title="Promote Address"><i class="bi bi-arrow-up-square"></i></a>
<a href="{{ url('system/address/pro',[$oo->id]) }}" title="Promote Address"><i class="bi bi-arrow-up-square"></i></a>
@endif
@if ((\App\Models\Address::NODE_NC|\App\Models\Address::NODE_HC) & $oo->role)
<a href="{{ url('ftn/system/demaddress',[$oo->id]) }}" title="Demote Address"><i class="bi bi-arrow-down-square"></i></a>
<a href="{{ url('system/address/dem',[$oo->id]) }}" title="Demote Address"><i class="bi bi-arrow-down-square"></i></a>
@endif
@endif
@endcan
@ -211,10 +211,10 @@
<td>{{ $oo->pivot->fixpass }}</td>
<td style="width: 70px;">
{{--
<a href="{{ url('ftn/system/modsession',[$oo->id]) }}" title="Modify Details" class="modify"><i class="bi bi-pen"></i></a>
<a href="{{ url('system/session/mod',[$oo->id]) }}" title="Modify Details" class="modify"><i class="bi bi-pen"></i></a>
--}}
<a href="{{ url('ftn/system/delsession',[$o->id,$oo->id]) }}" title="Delete Details" class="purge"><i class="bi bi-trash"></i></a>
<a href="{{ url('ftn/system/areafix',[$o->id,$oo->id]) }}" title="Areafix/Filefix"><i class="bi bi-envelope-paper"></i></a>
<a href="{{ url('system/session/del',[$o->id,$oo->id]) }}" title="Delete Details" class="purge"><i class="bi bi-trash"></i></a>
<a href="{{ url('system/areafix',[$o->id,$oo->id]) }}" title="Areafix/Filefix"><i class="bi bi-envelope-paper"></i></a>
</td>
</tr>
@endforeach

View File

@ -33,16 +33,16 @@
<tr>
<td><input type="radio" name="src" value="{{ $ao->id }}"></td>
<td><input type="radio" name="dst" value="{{ $ao->id }}"></td>
<th>{{ $ao->id }} {{ $ao->system_id }}:<a href="{{ url('ftn/system/addedit',$ao->system_id) }}">{{ $ao->system->name }}</a></th>
<th>{{ $ao->id }} {{ $ao->system_id }}:<a href="{{ url('system/addedit',$ao->system_id) }}">{{ $ao->system->name }}</a></th>
<th>{{ $ao->ftn }}</th>
<td>
@if($ao->trashed())
<a href="{{ url('ftn/system/recaddress',[$ao->id]) }}" title="Restore Address"><i class="bi bi-bandaid"></i></a>
<a href="{{ url('ftn/system/puraddress',[$ao->id]) }}" title="Purge Address" class="purge"><i class="bi bi-scissors"></i></a>
<a href="{{ url('system/address/rec',[$ao->id]) }}" title="Restore Address"><i class="bi bi-bandaid"></i></a>
<a href="{{ url('system/address/pur',[$ao->id]) }}" title="Purge Address" class="purge"><i class="bi bi-scissors"></i></a>
@else
<a href="{{ url('ftn/system/susaddress',[$ao->id]) }}" title="@if($ao->active)Pause @else Activate @endif Address"><i class="bi @if($ao->active)bi-pause-circle @else bi-play-circle @endif"></i></a>
<a href="{{ url('ftn/system/movaddress',[$ao->system_id,$ao->id]) }}" title="Move Address to another System"><i class="bi bi-arrow-right-square"></i></a>
<a href="{{ url('ftn/system/deladdress',[$ao->id]) }}" title="Delete Address"><i class="bi bi-trash"></i></a>
<a href="{{ url('system/address/sus',[$ao->id]) }}" title="@if($ao->active)Pause @else Activate @endif Address"><i class="bi @if($ao->active)bi-pause-circle @else bi-play-circle @endif"></i></a>
<a href="{{ url('system/address/mov',[$ao->system_id,$ao->id]) }}" title="Move Address to another System"><i class="bi bi-arrow-right-square"></i></a>
<a href="{{ url('system/address/del',[$ao->id]) }}" title="Delete Address"><i class="bi bi-trash"></i></a>
@endif
</td>
<td>

View File

@ -1,4 +1,4 @@
<form class="row g-0 needs-validation" method="post" action="{{ url('ftn/system/addaddress',$o->id) }}" novalidate>
<form class="row g-0 needs-validation" method="post" action="{{ url('system/address/add',$o->id) }}" novalidate>
<input type="hidden" id="action" name="action" value="">
@csrf
@ -169,7 +169,7 @@
<div class="row">
<div class="col-2">
<a href="{{ url('ftn/system') }}" class="btn btn-danger">Cancel</a>
<a href="{{ url('system') }}" class="btn btn-danger">Cancel</a>
</div>
<span class="col-6 mt-auto mx-auto text-center align-bottom">
@ -216,8 +216,7 @@
id = $(this).attr('data-id');
event.stopPropagation();
modify = $.get('{{ url('address/get') }}'+'/'+id,function(data) {
console.log(data.security);
modify = $.get('{{ url('system/api/address/get') }}'+'/'+id,function(data) {
$('#zone_id').val(data.zone_id).change();
$('#node_id').val(data.node_id).change();
$('#point_id').val(data.point_id).change();

View File

@ -3,7 +3,7 @@
->orderBy('zone_id')
->get())->count())
<form class="row g-0 needs-validation" method="post" action="{{ url('ftn/system/echoarea',$o->id) }}" novalidate>
<form class="row g-0 needs-validation" method="post" action="{{ url('system/echoarea',$o->id) }}" novalidate>
@csrf
<div class="row pt-0">
@ -124,7 +124,7 @@
if (e.status != 412)
alert('That didnt work? Please try again....');
},
url: '{{ url('system/address',[$o->id]) }}',
url: '{{ url('system/api/address',[$o->id]) }}',
cache: false
})
});
@ -161,7 +161,7 @@
if (e.status != 412)
alert('That didnt work? Please try again....');
},
url: '{{ url('ftn/system/echoarea',[$o->id]) }}',
url: '{{ url('system/echoarea',[$o->id]) }}',
cache: false
})
});

View File

@ -3,7 +3,7 @@
->orderBy('zone_id')
->get())->count())
<form class="row g-0 needs-validation" method="post" action="{{ url('ftn/system/filearea',$o->id) }}" novalidate>
<form class="row g-0 needs-validation" method="post" action="{{ url('system/filearea',$o->id) }}" novalidate>
@csrf
<div class="row pt-0">
@ -111,7 +111,7 @@
if (e.status != 412)
alert('That didnt work? Please try again....');
},
url: '{{ url('system/address',[$o->id]) }}',
url: '{{ url('system/api/address',[$o->id]) }}',
cache: false
})
});
@ -148,7 +148,7 @@
if (e.status != 412)
alert('That didnt work? Please try again....');
},
url: '{{ url('ftn/system/filearea',[$o->id]) }}',
url: '{{ url('system/filearea',[$o->id]) }}',
cache: false
})
});

View File

@ -6,7 +6,7 @@
<hr>
<form class="row g-0 needs-validation" method="post" action="{{ url('ftn/system/addsession',$o->id) }}" novalidate>
<form class="row g-0 needs-validation" method="post" action="{{ url('system/session/add',$o->id) }}" novalidate>
@csrf
<div class="row pt-0">
@ -108,7 +108,7 @@
<div class="row">
<div class="col-2">
<a href="{{ url('ftn/system') }}" class="btn btn-danger">Cancel</a>
<a href="{{ url('system') }}" class="btn btn-danger">Cancel</a>
</div>
<span class="col-6 mt-auto mx-auto text-center align-bottom">

View File

@ -15,12 +15,12 @@
<div class="col-12">
<p>This system is aware of the following systems
@can('create',(new \App\Models\System))(you can <a href="{{ url('user/system/register') }}">register</a> more):@endcan
@can('admin',(new \App\Models\System))(you can <a href="{{ url('ftn/system/addedit') }}">add</a> more):@endcan
@can('admin',(new \App\Models\System))(you can <a href="{{ url('system/addedit') }}">add</a> more):@endcan
</p>
@if (\App\Models\System::active()->count() === 0)
@can('create',(new \App\Models\System))
<p>There are no systems setup, to <a href="{{ url('ftn/system/addedit') }}">set up your first</a>.</p>
<p>There are no systems setup, to <a href="{{ url('system/addedit') }}">set up your first</a>.</p>
@else
<p class="pad">There are no systems - you need to ask an admin to create one for you.</p>
@endcan
@ -42,7 +42,7 @@
<tbody>
@foreach (\App\Models\System::active()->with(['addresses.zone.domain'])->get() as $oo)
<tr>
<td><a href="{{ url('ftn/system/addedit',[$oo->id]) }}" @cannot('update',$oo)class="disabled" @endcannot>{{ $oo->id }}</a></td>
<td><a href="{{ url('system/addedit',[$oo->id]) }}" @cannot('update',$oo)class="disabled" @endcannot>{{ $oo->id }}</a></td>
<td>{{ $oo->name }} @if(! $oo->active)<span class="float-end"><small>[i]</small></span>@endif</td>
<td>{{ $oo->sysop }}</td>
<td>{{ $oo->location }}</td>

View File

@ -41,7 +41,7 @@ Move Address
@enderror
</span>
<span class="input-helper">
Add a <a href="{{ url('ftn/system/addedit') }}">NEW System</a>
Add a <a href="{{ url('system/addedit') }}">NEW System</a>
</span>
</div>
</div>

View File

@ -31,7 +31,7 @@
@foreach (\App\Models\SystemZone::select('*')->with(['system','zone.domain'])->get() as $oo)
<tr>
<td>{{ $oo->zone->domain->name }}</td>
<td><a href="{{ url('ftn/system/addedit',[$oo->system_id]) }}">{{ $oo->system_id }}</a>@if($oo->system->hold)<span class="float-end"><i class="text-danger bi bi-stop-circle"></i></span>@endif</td>
<td><a href="{{ url('system/addedit',[$oo->system_id]) }}">{{ $oo->system_id }}</a>@if($oo->system->hold)<span class="float-end"><i class="text-danger bi bi-stop-circle"></i></span>@endif</td>
<td>{{ $oo->system->name }}</td>
<td>{{ $oo->system->sysop }}</td>
<td>{{ $oo->system->location }}</td>

View File

@ -13,7 +13,7 @@
<tbody>
<tr>
<th>System Name</th>
<td>{{ $o->name }} @can('update',$o)<span class="btn btn-success btn-sm float-end"><a href="{{ url('ftn/system/addedit',$o->id) }}">Edit</a></span>@endcan</td>
<td>{{ $o->name }} @can('update',$o)<span class="btn btn-success btn-sm float-end"><a href="{{ url('system/addedit',$o->id) }}">Edit</a></span>@endcan</td>
</tr>
<tr>
<th>Sysop</th>

View File

@ -24,7 +24,7 @@
<div class="row">
<div class="col-2">
<a href="{{ url('ftn/system') }}" class="btn btn-danger">Cancel</a>
<a href="{{ url('system') }}" class="btn btn-danger">Cancel</a>
</div>
<span class="col-6 mt-auto mx-auto text-center align-bottom">

View File

@ -24,7 +24,7 @@
<div class="row">
<div class="col-2">
<a href="{{ url('ftn/system') }}" class="btn btn-danger">Cancel</a>
<a href="{{ url('system') }}" class="btn btn-danger">Cancel</a>
</div>
<span class="col-6 mt-auto mx-auto text-center align-bottom">

View File

@ -302,7 +302,7 @@
<div class="col-12">
@if($o->exists)
@can($action,$o)
<a href="{{ url('ftn/system') }}" class="btn btn-danger">Cancel</a>
<a href="{{ url('system') }}" class="btn btn-danger">Cancel</a>
<button type="submit" name="submit" class="btn btn-success float-end">@if ($o->exists)Save @else Add @endif</button>
@else
<input type="hidden" name="system_id" value="{{ $o->id }}">

View File

@ -149,7 +149,7 @@
selectOnBlur: false,
appendTo: "#address_search_results",
source: function (query,process) {
addresssearch('{{ url('addresses/orphan') }}',query,process);
addresssearch('{{ url('system/api/address/orphan') }}',query,process);
},
matcher: function () { return true; },

View File

@ -100,7 +100,7 @@
A system is required.
@enderror
</span>
<span class="input-helper">Add a <a href="{{ url('ftn/system/addedit') }}">NEW System</a>. This system is the primary mailer/tosser responsible for managing the zone.</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>

View File

@ -51,9 +51,6 @@ Route::get('system/view/{o}',[SystemController::class,'view'])
Route::get('search',[HomeController::class,'search']);
Route::middleware(['auth','verified','activeuser'])->group(function () {
Route::get('address/get/{o}',[SystemController::class,'api_address_get'])
->where('o','[0-9]+');
Route::get('addresses/orphan',[SystemController::class,'api_orphan_address']);
Route::get('dashboard',[UserController::class,'dashboard']);
Route::post('default/{o}',[ZoneController::class,'api_default'])
->where('o','[0-9]+');
@ -68,43 +65,49 @@ Route::middleware(['auth','verified','activeuser'])->group(function () {
Route::match(['get','post'],'ftn/filearea/addedit/{o?}',[FileareaController::class,'add_edit'])
->where('o','[0-9]+');
Route::get('ftn/our_systems',[SystemController::class,'ours']);
Route::get('ftn/system',[SystemController::class,'home']);
Route::match(['get','post'],'ftn/system/addedit/{o?}',[SystemController::class,'add_edit'])
/* SYSTEM PATHS */
Route::view('system','system.home');
Route::post('system/api/address/{o}',[SystemController::class,'api_address'])
->where('o','[0-9]+');
Route::post('ftn/system/addaddress/{o}',[SystemController::class,'add_address'])
Route::get('system/api/address/get/{o}',[SystemController::class,'api_address_get'])
->where('o','[0-9]+');
Route::post('ftn/system/addsession/{o}',[SystemController::class,'add_session'])
Route::get('system/api/address/orphan',[SystemController::class,'api_address_orphan']);
Route::match(['get','post'],'system/addedit/{o?}',[SystemController::class,'add_edit'])
->where('o','[0-9]+');
Route::match(['get','post'],'ftn/system/areafix/{o}/{zo}',[SystemController::class,'areafix'])
->where('o','[0-9]+')
->where('zo','[0-9]+');
Route::get('ftn/system/deladdress/{o}',[SystemController::class,'del_address'])
Route::post('system/address/add/{o}',[SystemController::class,'address_add'])
->where('o','[0-9]+');
Route::get('ftn/system/demaddress/{o}',[SystemController::class,'dem_address'])
Route::get('system/address/del/{o}',[SystemController::class,'address_del'])
->where('o','[0-9]+');
Route::get('ftn/system/delsession/{o}/{zo}',[SystemController::class,'del_session'])
->where('o','[0-9]+')
->where('zo','[0-9]+');
Route::get('ftn/system/proaddress/{o}',[SystemController::class,'pro_address'])
Route::get('system/address/dem/{o}',[SystemController::class,'address_dem'])
->where('o','[0-9]+');
Route::match(['get','post'],'ftn/system/echoarea/{o}',[SystemController::class,'echoareas'])
->where('o','[0-9]+');
Route::match(['get','post'],'ftn/system/filearea/{o}',[SystemController::class,'fileareas'])
->where('o','[0-9]+');
Route::match(['get','post'],'ftn/system/movaddress/{so}/{o}',[SystemController::class,'mov_address'])
Route::match(['get','post'],'system/address/mov/{so}/{o}',[SystemController::class,'address_mov'])
->where('so','[0-9]+')
->where('o','[0-9]+');
Route::get('system/address/pro/{o}',[SystemController::class,'address_pro'])
->where('o','[0-9]+');
Route::get('system/address/pur/{id}',[SystemController::class,'address_pur'])
->where('o','[0-9]+');
Route::get('system/address/rec/{id}',[SystemController::class,'address_rec'])
->where('o','[0-9]+');
Route::get('system/address/sus/{o}',[SystemController::class,'address_sus'])
->where('o','[0-9]+');
Route::match(['get','post'],'system/areafix/{o}/{zo}',[SystemController::class,'areafix'])
->where('o','[0-9]+')
->where('zo','[0-9]+');
Route::match(['get','post'],'system/echoarea/{o}',[SystemController::class,'echoareas'])
->where('o','[0-9]+');
Route::match(['get','post'],'system/filearea/{o}',[SystemController::class,'fileareas'])
->where('o','[0-9]+');
Route::view('system/ours','system.ours');
Route::post('system/session/add/{o}',[SystemController::class,'session_add'])
->where('o','[0-9]+');
Route::get('system/session/del/{o}/{zo}',[SystemController::class,'session_del'])
->where('o','[0-9]+')
->where('zo','[0-9]+');
Route::post('file/contents/{o}/{date}',[HomeController::class,'file_contents'])
->where('o','[0-9]+')
->where('date','[0-9:\-@]+');
Route::get('ftn/system/recaddress/{id}',[SystemController::class,'rec_address'])
->where('o','[0-9]+');
Route::get('ftn/system/puraddress/{id}',[SystemController::class,'pur_address'])
->where('o','[0-9]+');
Route::get('ftn/system/susaddress/{o}',[SystemController::class,'sus_address'])
->where('o','[0-9]+');
Route::get('ftn/zone',[ZoneController::class,'home']);
Route::match(['get','post'],'ftn/zone/addedit/{o?}',[ZoneController::class,'add_edit'])
->where('o','[0-9]+');
@ -121,10 +124,8 @@ Route::middleware(['auth','verified','activeuser'])->group(function () {
Route::get('permissions',[HomeController::class,'permissions']);
Route::get('regions/{o}',[DomainController::class,'api_regions'])
->where('o','[0-9]+');
Route::post('system/address/{o}',[SystemController::class,'api_address'])
->where('o','[0-9]+');
Route::get('systems/orphan',[SystemController::class,'api_orphan']);
Route::match(['get','post'],'user/system/register',[SystemController::class,'system_register']);
Route::match(['get','post'],'user/system/register',[SystemController::class,'register']);
Route::match(['post'],'user/system/link',[SystemController::class,'system_link']);
});