diff --git a/app/Http/Controllers/SystemController.php b/app/Http/Controllers/SystemController.php index aedcf16..4d07174 100644 --- a/app/Http/Controllers/SystemController.php +++ b/app/Http/Controllers/SystemController.php @@ -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 [%s]',$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 [%s]',$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']); diff --git a/resources/views/dashboard.blade.php b/resources/views/dashboard.blade.php index c11c550..6a5d248 100644 --- a/resources/views/dashboard.blade.php +++ b/resources/views/dashboard.blade.php @@ -23,7 +23,7 @@ @foreach ($user->systems as $o) - {{ $o->name }} + {{ $o->name }} {!! $o->akas->pluck('ftn')->join('
') !!} @endforeach @@ -41,7 +41,7 @@ @foreach ($user->systems as $o) - {{ $o->name }} + {{ $o->name }} {!! $o->addresses->pluck('zone.domain.echoareas')->flatten()->pluck('name')->unique()->sort()->join(', ') !!} @endforeach diff --git a/resources/views/domain/view.blade.php b/resources/views/domain/view.blade.php index 338ce4a..3f5e64e 100644 --- a/resources/views/domain/view.blade.php +++ b/resources/views/domain/view.blade.php @@ -126,7 +126,7 @@ @foreach ($o->zones->sortBy('zone_id') as $oz) @foreach ($oz->addresses as $ao) - {{ $ao->system->full_name($ao) }} @auth@if($ao->session('sespass')){{ $ao->session('default') ? '**' : '*' }}@elseif($ao->system->setup)+@endif[{{ $ao->system_id }}]@endauth + {{ $ao->system->full_name($ao) }} @auth@if($ao->session('sespass')){{ $ao->session('default') ? '**' : '*' }}@elseif($ao->system->setup)+@endif[{{ $ao->system_id }}]@endauth {{ $ao->system->sysop }} {{ $ao->system->location }} {{ $ao->ftn4d }} diff --git a/resources/views/echoarea/addedit.blade.php b/resources/views/echoarea/addedit.blade.php index d1daa2e..23d4de7 100644 --- a/resources/views/echoarea/addedit.blade.php +++ b/resources/views/echoarea/addedit.blade.php @@ -178,7 +178,7 @@ @foreach ($o->addresses as $ao) - {{ $ao->system->full_name($ao) }} @auth@if($ao->session('sespass')){{ $ao->session('default') ? '**' : '*' }}@elseif($ao->system->setup)+@endif[{{ $ao->system_id }}]@endauth + {{ $ao->system->full_name($ao) }} @auth@if($ao->session('sespass')){{ $ao->session('default') ? '**' : '*' }}@elseif($ao->system->setup)+@endif[{{ $ao->system_id }}]@endauth {{ $ao->ftn_3d }} {{ $ao->system->last_session ? $ao->system->last_session->format('Y-m-d H:i') : '-' }} {{ ($x=$o->waiting($ao))->count() ? $x->first()->datetime->format('Y-m-d H:i') : '-' }} diff --git a/resources/views/layouts/partials/sidebar.blade.php b/resources/views/layouts/partials/sidebar.blade.php index 77c6969..1033809 100644 --- a/resources/views/layouts/partials/sidebar.blade.php +++ b/resources/views/layouts/partials/sidebar.blade.php @@ -5,7 +5,7 @@
My Systems
@foreach ($user->systems->sortBy('name') as $o) -
{{ $o->name }}
+
{{ $o->name }}
@endforeach
@endauth @@ -26,7 +26,7 @@
Network Admin
Domains
-
Systems
+
Systems
Zones
Echoareas
Fileareas
@@ -34,7 +34,7 @@
System Admin
-
This Host Systems
+
This Host Systems
@endif diff --git a/resources/views/setup.blade.php b/resources/views/setup.blade.php index a1d1fb5..ea7fb69 100644 --- a/resources/views/setup.blade.php +++ b/resources/views/setup.blade.php @@ -45,9 +45,9 @@ use App\Classes\Protocol\{Binkp,EMSI,DNS}; @if(! $o->system_id) - Add a NEW System + Add a NEW System @else - Edit System + Edit System @endif diff --git a/resources/views/system/addedit.blade.php b/resources/views/system/addedit.blade.php index 9fda843..cb195d4 100644 --- a/resources/views/system/addedit.blade.php +++ b/resources/views/system/addedit.blade.php @@ -118,18 +118,18 @@ @elseif($oo->trashed()) - - + + @else - - - - + + + + @if ((\App\Models\Address::NODE_HC|\App\Models\Address::NODE_ACTIVE) & $oo->role) - + @endif @if ((\App\Models\Address::NODE_NC|\App\Models\Address::NODE_HC) & $oo->role) - + @endif @endif @endcan @@ -211,10 +211,10 @@ {{ $oo->pivot->fixpass }} {{-- - + --}} - - + + @endforeach diff --git a/resources/views/system/address-merge.blade.php b/resources/views/system/address-merge.blade.php index 4116d50..753f3b4 100644 --- a/resources/views/system/address-merge.blade.php +++ b/resources/views/system/address-merge.blade.php @@ -33,16 +33,16 @@ - {{ $ao->id }} {{ $ao->system_id }}:{{ $ao->system->name }} + {{ $ao->id }} {{ $ao->system_id }}:{{ $ao->system->name }} {{ $ao->ftn }} @if($ao->trashed()) - - + + @else - - - + + + @endif diff --git a/resources/views/system/form-address.blade.php b/resources/views/system/form-address.blade.php index 1d7ef02..95d0252 100644 --- a/resources/views/system/form-address.blade.php +++ b/resources/views/system/form-address.blade.php @@ -1,4 +1,4 @@ -
+ @csrf @@ -169,7 +169,7 @@
@@ -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(); diff --git a/resources/views/system/form-echoarea.blade.php b/resources/views/system/form-echoarea.blade.php index cc0041d..2f47134 100644 --- a/resources/views/system/form-echoarea.blade.php +++ b/resources/views/system/form-echoarea.blade.php @@ -3,7 +3,7 @@ ->orderBy('zone_id') ->get())->count()) - + @csrf
@@ -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 }) }); diff --git a/resources/views/system/form-filearea.blade.php b/resources/views/system/form-filearea.blade.php index a46e1f4..253865e 100644 --- a/resources/views/system/form-filearea.blade.php +++ b/resources/views/system/form-filearea.blade.php @@ -3,7 +3,7 @@ ->orderBy('zone_id') ->get())->count()) - + @csrf
@@ -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 }) }); diff --git a/resources/views/system/form-session.blade.php b/resources/views/system/form-session.blade.php index ce9c038..4d7a2c1 100644 --- a/resources/views/system/form-session.blade.php +++ b/resources/views/system/form-session.blade.php @@ -6,7 +6,7 @@
- + @csrf
@@ -108,7 +108,7 @@
diff --git a/resources/views/system/home.blade.php b/resources/views/system/home.blade.php index 4667626..41e092b 100644 --- a/resources/views/system/home.blade.php +++ b/resources/views/system/home.blade.php @@ -15,12 +15,12 @@

This system is aware of the following systems @can('create',(new \App\Models\System))(you can register more):@endcan - @can('admin',(new \App\Models\System))(you can add more):@endcan + @can('admin',(new \App\Models\System))(you can add more):@endcan

@if (\App\Models\System::active()->count() === 0) @can('create',(new \App\Models\System)) -

There are no systems setup, to set up your first.

+

There are no systems setup, to set up your first.

@else

There are no systems - you need to ask an admin to create one for you.

@endcan @@ -42,7 +42,7 @@ @foreach (\App\Models\System::active()->with(['addresses.zone.domain'])->get() as $oo) - {{ $oo->id }} + {{ $oo->id }} {{ $oo->name }} @if(! $oo->active)[i]@endif {{ $oo->sysop }} {{ $oo->location }} diff --git a/resources/views/system/moveaddr.blade.php b/resources/views/system/moveaddr.blade.php index 905cbca..d086741 100644 --- a/resources/views/system/moveaddr.blade.php +++ b/resources/views/system/moveaddr.blade.php @@ -41,7 +41,7 @@ Move Address @enderror - Add a NEW System + Add a NEW System
diff --git a/resources/views/system/ours.blade.php b/resources/views/system/ours.blade.php index c7afeca..74fd27a 100644 --- a/resources/views/system/ours.blade.php +++ b/resources/views/system/ours.blade.php @@ -31,7 +31,7 @@ @foreach (\App\Models\SystemZone::select('*')->with(['system','zone.domain'])->get() as $oo) {{ $oo->zone->domain->name }} - {{ $oo->system_id }}@if($oo->system->hold)@endif + {{ $oo->system_id }}@if($oo->system->hold)@endif {{ $oo->system->name }} {{ $oo->system->sysop }} {{ $oo->system->location }} diff --git a/resources/views/system/view.blade.php b/resources/views/system/view.blade.php index 3e727be..40430e7 100644 --- a/resources/views/system/view.blade.php +++ b/resources/views/system/view.blade.php @@ -13,7 +13,7 @@ System Name - {{ $o->name }} @can('update',$o)Edit@endcan + {{ $o->name }} @can('update',$o)Edit@endcan Sysop diff --git a/resources/views/system/widget/echoarea.blade.php b/resources/views/system/widget/echoarea.blade.php index a710072..88188ec 100644 --- a/resources/views/system/widget/echoarea.blade.php +++ b/resources/views/system/widget/echoarea.blade.php @@ -24,7 +24,7 @@
diff --git a/resources/views/system/widget/filearea.blade.php b/resources/views/system/widget/filearea.blade.php index d7cf41d..bd0e496 100644 --- a/resources/views/system/widget/filearea.blade.php +++ b/resources/views/system/widget/filearea.blade.php @@ -24,7 +24,7 @@
diff --git a/resources/views/system/widget/form-system.blade.php b/resources/views/system/widget/form-system.blade.php index a9dd72f..93ade40 100644 --- a/resources/views/system/widget/form-system.blade.php +++ b/resources/views/system/widget/form-system.blade.php @@ -302,7 +302,7 @@
@if($o->exists) @can($action,$o) - Cancel + Cancel @else diff --git a/resources/views/user/link.blade.php b/resources/views/user/link.blade.php index d50a643..12a814f 100644 --- a/resources/views/user/link.blade.php +++ b/resources/views/user/link.blade.php @@ -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; }, diff --git a/resources/views/zone/addedit.blade.php b/resources/views/zone/addedit.blade.php index 82920c4..d839887 100644 --- a/resources/views/zone/addedit.blade.php +++ b/resources/views/zone/addedit.blade.php @@ -100,7 +100,7 @@ A system is required. @enderror - Add a NEW System. This system is the primary mailer/tosser responsible for managing the zone. + Add a NEW System. This system is the primary mailer/tosser responsible for managing the zone.
diff --git a/routes/web.php b/routes/web.php index a997f10..024f616 100644 --- a/routes/web.php +++ b/routes/web.php @@ -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']); });