Added echoareas and fileareas

This commit is contained in:
Deon George 2021-08-11 23:45:30 +10:00
parent c7388c2db6
commit eb0405f019
19 changed files with 773 additions and 48 deletions

View File

@ -12,6 +12,7 @@ use Illuminate\Validation\Validator as ValidatorResult;
use App\Classes\FTN as FTNBase; use App\Classes\FTN as FTNBase;
use App\Models\{Address,Domain}; use App\Models\{Address,Domain};
use App\Rules\TwoByteInteger; use App\Rules\TwoByteInteger;
use App\Traits\EncodeUTF8;
/** /**
* Class Message * Class Message
@ -21,6 +22,8 @@ use App\Rules\TwoByteInteger;
*/ */
class Message extends FTNBase class Message extends FTNBase
{ {
use EncodeUTF8;
private const cast_utf8 = [ private const cast_utf8 = [
'message', 'message',
'message_src', 'message_src',
@ -342,43 +345,7 @@ class Message extends FTNBase
*/ */
public function __serialize(): array public function __serialize(): array
{ {
$values = []; return $this->encode();
$properties = (new \ReflectionClass($this))->getProperties();
$class = get_class($this);
foreach ($properties as $property) {
// Dont serialize the validation error
if ($property->name == 'errors')
continue;
if ($property->isStatic()) {
continue;
}
$property->setAccessible(true);
if (! $property->isInitialized($this)) {
continue;
}
$name = $property->getName();
$encode = in_array($name,self::cast_utf8);
if ($property->isPrivate()) {
$name = "\0{$class}\0{$name}";
} elseif ($property->isProtected()) {
$name = "\0*\0{$name}";
}
$property->setAccessible(true);
$value = $property->getValue($this);
$values[$name] = $encode ? utf8_encode($value) : $value;
}
return $values;
} }
/** /**

View File

@ -0,0 +1,49 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Echoarea;
class EchoareaController extends Controller
{
public function __construct()
{
$this->middleware('auth');
}
/**
* Add or edit a echoarea
*/
public function add_edit(Request $request,Echoarea $o)
{
if ($request->post()) {
$this->authorize('admin',$o);
$request->validate([
// http://ftsc.org/docs/old/fsp-1028.002
'domain_id' => 'required|exists:domains,id',
'name' => 'required|max:35|regex:/^[a-zA-Z-_~]{1,8}$/|unique:echoareas,name,'.($o->exists ? $o->id : 0),
'description' => 'required',
'active' => 'required|boolean',
'public' => 'required|boolean',
]);
foreach (['name','description','active','public','notes','domain_id'] as $key)
$o->{$key} = $request->post($key);
$o->save();
return redirect()->action([self::class,'home']);
}
return view('echoarea.addedit')
->with('o',$o);
}
public function home()
{
return view('echoarea.home');
}
}

View File

@ -0,0 +1,48 @@
<?php
namespace App\Http\Controllers;
use App\Models\Filearea;
use Illuminate\Http\Request;
class FileareaController extends Controller
{
public function __construct()
{
$this->middleware('auth');
}
/**
* Add or edit a echoarea
*/
public function add_edit(Request $request,Filearea $o)
{
if ($request->post()) {
$this->authorize('admin',$o);
$request->validate([
// http://ftsc.org/docs/old/fsp-1028.002
'domain_id' => 'required|exists:domains,id',
'name' => 'required|max:35|regex:/^[a-zA-Z-_~]{1,8}$/|unique:echoareas,name,'.($o->exists ? $o->id : 0),
'description' => 'required',
'active' => 'required|boolean',
'public' => 'required|boolean',
]);
foreach (['name','description','active','public','notes','domain_id'] as $key)
$o->{$key} = $request->post($key);
$o->save();
return redirect()->action([self::class,'home']);
}
return view('filearea.addedit')
->with('o',$o);
}
public function home()
{
return view('filearea.home');
}
}

View File

@ -10,7 +10,7 @@ use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use App\Classes\FTN\{Message,Process}; use App\Classes\FTN\{Message,Process};
use App\Models\{Echomail,Netmail,Setup}; use App\Models\{Echoarea,Echomail,Netmail,Setup};
class ProcessPacket implements ShouldQueue class ProcessPacket implements ShouldQueue
{ {
@ -141,7 +141,10 @@ class ProcessPacket implements ShouldQueue
$this->msg->user_from, $this->msg->user_from,
)); ));
// @todo Determine if we know about this echo area $ea = Echoarea::where('name',$this->msg->echoarea)
->where('domain_id',$this->msg->fftn_o->zone->domain_id)
->single();
// @todo Can the sender create it if it doesnt exist? // @todo Can the sender create it if it doesnt exist?
// - Create it, or // - Create it, or
// - Else record in bad area // - Else record in bad area
@ -155,7 +158,7 @@ class ProcessPacket implements ShouldQueue
$o->tzoffset = $this->msg->date->utcOffset(); $o->tzoffset = $this->msg->date->utcOffset();
$o->fftn_id = ($x=$this->msg->fftn_o) ? $x->id : NULL; $o->fftn_id = ($x=$this->msg->fftn_o) ? $x->id : NULL;
$o->echoarea = $this->msg->echoarea; $o->echoarea_id = $ea?->id;
$o->msgid = $this->msg->msgid; $o->msgid = $this->msg->msgid;
$o->msg = $this->msg->message_src; $o->msg = $this->msg->message_src;

View File

@ -23,6 +23,16 @@ class Domain extends Model
/* RELATIONS */ /* RELATIONS */
public function echoareas()
{
return $this->hasMany(Echoarea::class);
}
public function fileareas()
{
return $this->hasMany(Filearea::class);
}
public function zones() public function zones()
{ {
return $this->hasMany(Zone::class); return $this->hasMany(Zone::class);

31
app/Models/Echoarea.php Normal file
View File

@ -0,0 +1,31 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use App\Traits\ScopeActive;
class Echoarea extends Model
{
use SoftDeletes,ScopeActive;
/* RELATIONS */
public function addresses()
{
return $this->belongsToMany(Address::class);
}
public function domain()
{
return $this->belongsTo(Domain::class);
}
public function echomail()
{
return Echomail::select('*')
->where('echoarea_id',$this->id);
}
}

View File

@ -2,17 +2,22 @@
namespace App\Models; namespace App\Models;
use Carbon\Exceptions\Exception;
use Jenssegers\Mongodb\Eloquent\Model; use Jenssegers\Mongodb\Eloquent\Model;
use Jenssegers\Mongodb\Eloquent\SoftDeletes; use Jenssegers\Mongodb\Eloquent\SoftDeletes;
use App\Classes\FTN\Message; use App\Classes\FTN\Message;
use App\Interfaces\Packet; use App\Interfaces\Packet;
use App\Traits\{MsgID,UseMongo}; use App\Traits\{EncodeUTF8,MsgID,UseMongo};
class Echomail extends Model implements Packet class Echomail extends Model implements Packet
{ {
use SoftDeletes,MsgID,UseMongo; use SoftDeletes,MsgID,UseMongo,EncodeUTF8;
protected $collection = FALSE;
private const cast_utf8 = [
'msg'
];
protected $dates = ['datetime']; protected $dates = ['datetime'];
@ -28,6 +33,11 @@ class Echomail extends Model implements Packet
/* METHODS */ /* METHODS */
public function jsonSerialize(): array
{
return $this->encode();
}
/** /**
* Return this model as a packet * Return this model as a packet
*/ */

25
app/Models/Filearea.php Normal file
View File

@ -0,0 +1,25 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use App\Traits\ScopeActive;
class Filearea extends Model
{
use SoftDeletes,ScopeActive;
/* RELATIONS */
public function addresses()
{
return $this->belongsToMany(Address::class);
}
public function domain()
{
return $this->belongsTo(Domain::class);
}
}

View File

@ -90,7 +90,6 @@ class Netmail extends Model implements Packet
$o->via = $via; $o->via = $via;
return $o; return $o;
} }
} }

50
app/Traits/EncodeUTF8.php Normal file
View File

@ -0,0 +1,50 @@
<?php
/**
* Encode our data so that it can be serialised
*/
namespace App\Traits;
trait EncodeUTF8
{
private function encode(): array
{
$values = [];
$properties = (new \ReflectionClass($this))->getProperties();
$class = get_class($this);
foreach ($properties as $property) {
// Dont serialize the validation error
if ($property->name == 'errors')
continue;
if ($property->isStatic()) {
continue;
}
$property->setAccessible(true);
if (! $property->isInitialized($this)) {
continue;
}
$name = $property->getName();
$encode = in_array($name,self::cast_utf8);
if ($property->isPrivate()) {
$name = "\0{$class}\0{$name}";
} elseif ($property->isProtected()) {
$name = "\0*\0{$name}";
}
$property->setAccessible(true);
$value = $property->getValue($this);
$values[$name] = $encode ? utf8_encode($value) : $value;
}
return $values;
}
}

View File

@ -0,0 +1,97 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class Echomail extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('echoareas', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->softDeletes();
$table->string('name');
$table->string('description');
$table->boolean('active');
$table->boolean('public');
$table->string('notes')->nullable();
$table->integer('domain_id');
$table->foreign('domain_id')->references('id')->on('domains');
});
Schema::create('fileareas', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->softDeletes();
$table->string('name');
$table->string('description');
$table->boolean('active');
$table->boolean('public');
$table->string('notes')->nullable();
$table->integer('domain_id');
$table->foreign('domain_id')->references('id')->on('domains');
});
Schema::create('address_echoarea', function (Blueprint $table) {
$table->integer('echoarea_id');
$table->foreign('echoarea_id')->references('id')->on('echoareas');
$table->integer('address_id');
$table->foreign('address_id')->references('id')->on('addresses');
$table->dateTime('subscribed');
});
Schema::create('address_filearea', function (Blueprint $table) {
$table->integer('filearea_id');
$table->foreign('filearea_id')->references('id')->on('fileareas');
$table->integer('address_id');
$table->foreign('address_id')->references('id')->on('addresses');
$table->dateTime('subscribed');
});
Schema::create('address_echomail', function (Blueprint $table) {
$table->integer('echomail_id');
$table->string('packet');
$table->integer('address_id');
$table->foreign('address_id')->references('id')->on('addresses');
});
Schema::create('address_file', function (Blueprint $table) {
$table->integer('filearea_id');
$table->boolean('sent');
$table->integer('address_id');
$table->foreign('address_id')->references('id')->on('addresses');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('address_file');
Schema::dropIfExists('address_echomail');
Schema::dropIfExists('address_filearea');
Schema::dropIfExists('fileareas');
Schema::dropIfExists('address_echoarea');
Schema::dropIfExists('echoareas');
}
}

View File

@ -78,5 +78,19 @@ class InitialSetupSeeder extends Seeder
'active'=>TRUE, 'active'=>TRUE,
'password'=>'$2y$10$bJQDLfxnKrh6o5Sa02MZOukXcLTNQiByXSTJ7fTr.kHMpV2wxbG6.', 'password'=>'$2y$10$bJQDLfxnKrh6o5Sa02MZOukXcLTNQiByXSTJ7fTr.kHMpV2wxbG6.',
]); ]);
DB::table('echoareas')->insert([
'name'=>'-BAD_AREA',
'description'=>'Inbound invalid echomail',
'active'=>TRUE,
'domain_id'=>$do->id,
]);
DB::table('fileareas')->insert([
'name'=>'-BAD_AREA',
'description'=>'Inbound invalid files',
'active'=>TRUE,
'domain_id'=>$do->id,
]);
} }
} }

View File

@ -26,7 +26,27 @@
<div id="collapse_echoareas" class="accordion-collapse collapse" aria-labelledby="echoareas" data-bs-parent="#accordion_homepage"> <div id="collapse_echoareas" class="accordion-collapse collapse" aria-labelledby="echoareas" data-bs-parent="#accordion_homepage">
<div class="accordion-body"> <div class="accordion-body">
@if(FALSE) @if($o->echoareas->count())
<p>This network provides the following Echomail areas:</p>
<table class="table monotable" id="network">
<thead>
<tr>
<th>Echoarea</th>
<th>Description</th>
<th>Last Message</th>
</tr>
</thead>
<tbody>
@foreach ($o->echoareas->sortBy('name') as $oo)
<tr>
<td><a href="{{ url('ftn/echoarea/addedit',[$oo->id]) }}">{{ $oo->name }}</a></td>
<td>{{ $oo->description }}</td>
<td>{{ ($x=$oo->echomail()->orderBy('created_at','DESC')->first()) ? $x->created_at->format('Y-m-d H:i') : '-' }}</td>
</tr>
@endforeach
</tbody>
</table>
@else @else
This network doesnt have any Echomail areas (yet). Perhaps you would like to create one? This network doesnt have any Echomail areas (yet). Perhaps you would like to create one?
@endif @endif
@ -40,7 +60,27 @@
<div id="collapse_fileareas" class="accordion-collapse collapse" aria-labelledby="fileareas" data-bs-parent="#accordion_homepage"> <div id="collapse_fileareas" class="accordion-collapse collapse" aria-labelledby="fileareas" data-bs-parent="#accordion_homepage">
<div class="accordion-body"> <div class="accordion-body">
@if(FALSE) @if($o->fileareas->count())
<p>This network provides the following File areas:</p>
<table class="table monotable" id="network">
<thead>
<tr>
<th>Filearea</th>
<th>Description</th>
<th>Last File Sent</th>
</tr>
</thead>
<tbody>
@foreach ($o->fileareas->sortBy('name') as $oo)
<tr>
<td><a href="{{ url('ftn/filearea/addedit',[$oo->id]) }}">{{ $oo->name }}</a></td>
<td>{{ $oo->description }}</td>
<td>-</td>
</tr>
@endforeach
</tbody>
</table>
@else @else
This network doesnt have any File areas (yet). Perhaps you would like to create one? This network doesnt have any File areas (yet). Perhaps you would like to create one?
@endif @endif

View File

@ -0,0 +1,115 @@
@extends('layouts.app')
@section('htmlheader_title')
@if($o->exists) Update @else Add @endif Echoarea
@endsection
@section('content')
<form class="row g-0 needs-validation" method="post" novalidate>
@csrf
<div class="row">
<div class="col-12">
<div class="greyframe titledbox shadow0xb0">
<h2 class="cap">@if($o->exists) Update @else Add @endif Echoarea</h2>
<div class="row">
<div class="col-3">
<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()->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('ftn/domain/addedit') }}">NEW Domain</a></span>
</div>
</div>
<div class="col-4">
<label for="name" class="form-label">Name</label>
<div class="input-group has-validation">
<span class="input-group-text"><i class="bi bi-tag-fill"></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('admin',$o)disabled @endcannot autofocus>
<span class="invalid-feedback" role="alert">
@error('name')
{{ $message }}
@else
A name is required.
@enderror
</span>
</div>
</div>
<div class="col-2">
<label for="active" class="form-label">Active</label>
<div class="input-group">
<div class="btn-group" role="group">
<input type="radio" class="btn-check" name="active" id="active_yes" value="1" required @cannot('admin',$o)disabled @endcannot @if(old('active',$o->active ?? TRUE))checked @endif>
<label class="btn btn-outline-success" for="active_yes">Yes</label>
<input type="radio" class="btn-check btn-danger" name="active" id="active_no" value="0" required @cannot('admin',$o)disabled @endcannot @if(! old('active',$o->active ?? TRUE))checked @endif>
<label class="btn btn-outline-danger" for="active_no">No</label>
</div>
</div>
</div>
<div class="col-2">
<label for="public" class="form-label">Public</label>
<div class="input-group">
<div class="btn-group" role="group">
<input type="radio" class="btn-check" name="public" id="public_yes" value="1" required @cannot('admin',$o)disabled @endcannot @if(old('public',$o->public ?? TRUE))checked @endif>
<label class="btn btn-outline-success" for="public_yes">Yes</label>
<input type="radio" class="btn-check btn-danger" name="public" id="public_no" value="0" required @cannot('admin',$o)disabled @endcannot @if(! old('public',$o->public ?? TRUE))checked @endif>
<label class="btn btn-outline-danger" for="public_no">No</label>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-8">
<label for="description" class="form-label">Description</label>
<div class="input-group has-validation">
<span class="input-group-text"><i class="bi bi-file-text-fill"></i></span>
<input type="text" class="form-control @error('description') is-invalid @enderror" id="description" placeholder="Description" name="description" value="{{ old('description',$o->description) }}" @cannot('admin',$o)disabled @endcannot>
<span class="invalid-feedback" role="alert">
@error('description')
{{ $message }}
@enderror
</span>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<label for="notes" class="form-label">Notes</label>
<textarea class="form-control" rows=3 name="notes" placeholder="Notes..." @cannot('admin',$o)disabled @endcannot>{{ old('notes',$o->notes) }}</textarea>
</div>
</div>
<div class="row">
<div class="col-12">
<a href="{{ url('ftn/echoarea') }}" class="btn btn-danger">Cancel</a>
@can('admin',$o)
<button type="submit" name="submit" class="btn btn-success float-end">@if ($o->exists)Save @else Add @endif</button>
@endcan
</div>
</div>
</div>
</div>
</div>
</form>
@endsection

View File

@ -0,0 +1,68 @@
@extends('layouts.app')
@section('htmlheader_title')
Echoareas
@endsection
@section('content')
<div class="row">
<div class="col-12">
<h2>About Echoareas</h2>
<p>BBS Systems exchange public messages called <strong class="highlight">echomail</strong>. Echomail is grouped into <strong class="highlight">echoareas</strong> normally around a theme or a topic.</p>
<p>Each echoarea has a unique <strong class="highlight">areatag</strong> which helps a receiving BBS to know where to file the message when it is received.</p>
</div>
</div>
<div class="row">
<div class="col-6">
<p>This system is aware of the following echoareas:</p>
@if (\App\Models\Echoarea::count() == 0)
@can('admin',(new \App\Models\Echoarea))
<p>There are no echoareas setup, to <a href="{{ url('ftn/echoarea/addedit') }}">set up your first</a>.</p>
@else
<p class="pad">There are no echoareas - you need to ask an admin to create one for you.</p>
@endcan
@else
<table class="table monotable">
<thead>
<tr>
<th>ID</th>
<th>Areatag</th>
<th>Description</th>
<th>Active</th>
<th>Domain</th>
</tr>
</thead>
<tbody>
@can('admin',(new \App\Models\Echoarea))
<tr>
<td colspan="5"><a href="{{ url('ftn/echoarea/addedit') }}">Add New Echoarea</a></td>
</tr>
@endcan
@foreach (\App\Models\Echoarea::orderBy('name')->with(['domain'])->get() as $oo)
<tr>
<td><a href="{{ url('ftn/echoarea/addedit',[$oo->id]) }}">{{ $oo->id }}</a></td>
<td>{{ $oo->name }}</td>
<td>{{ $oo->description }}</td>
<td>{{ $oo->active ? 'YES' : 'NO' }}</td>
<td>{{ $oo->domain->name }}</td>
</tr>
@endforeach
</tbody>
</table>
@endif
</div>
</div>
@endsection
@section('page-scripts')
<script type="text/javascript">
$('table tr').click(function() {
var href = $(this).find('a').attr('href');
if (href)
window.location = href;
});
</script>
@append

View File

@ -0,0 +1,115 @@
@extends('layouts.app')
@section('htmlheader_title')
@if($o->exists) Update @else Add @endif Filearea
@endsection
@section('content')
<form class="row g-0 needs-validation" method="post" novalidate>
@csrf
<div class="row">
<div class="col-12">
<div class="greyframe titledbox shadow0xb0">
<h2 class="cap">@if($o->exists) Update @else Add @endif Filearea</h2>
<div class="row">
<div class="col-3">
<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()->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('ftn/domain/addedit') }}">NEW Domain</a></span>
</div>
</div>
<div class="col-4">
<label for="name" class="form-label">Name</label>
<div class="input-group has-validation">
<span class="input-group-text"><i class="bi bi-tag-fill"></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('admin',$o)disabled @endcannot autofocus>
<span class="invalid-feedback" role="alert">
@error('name')
{{ $message }}
@else
A name is required.
@enderror
</span>
</div>
</div>
<div class="col-2">
<label for="active" class="form-label">Active</label>
<div class="input-group">
<div class="btn-group" role="group">
<input type="radio" class="btn-check" name="active" id="active_yes" value="1" required @cannot('admin',$o)disabled @endcannot @if(old('active',$o->active ?? TRUE))checked @endif>
<label class="btn btn-outline-success" for="active_yes">Yes</label>
<input type="radio" class="btn-check btn-danger" name="active" id="active_no" value="0" required @cannot('admin',$o)disabled @endcannot @if(! old('active',$o->active ?? TRUE))checked @endif>
<label class="btn btn-outline-danger" for="active_no">No</label>
</div>
</div>
</div>
<div class="col-2">
<label for="public" class="form-label">Public</label>
<div class="input-group">
<div class="btn-group" role="group">
<input type="radio" class="btn-check" name="public" id="public_yes" value="1" required @cannot('admin',$o)disabled @endcannot @if(old('public',$o->public ?? TRUE))checked @endif>
<label class="btn btn-outline-success" for="public_yes">Yes</label>
<input type="radio" class="btn-check btn-danger" name="public" id="public_no" value="0" required @cannot('admin',$o)disabled @endcannot @if(! old('public',$o->public ?? TRUE))checked @endif>
<label class="btn btn-outline-danger" for="public_no">No</label>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-8">
<label for="description" class="form-label">Description</label>
<div class="input-group has-validation">
<span class="input-group-text"><i class="bi bi-file-text-fill"></i></span>
<input type="text" class="form-control @error('description') is-invalid @enderror" id="description" placeholder="Description" name="description" value="{{ old('description',$o->description) }}" @cannot('admin',$o)disabled @endcannot>
<span class="invalid-feedback" role="alert">
@error('description')
{{ $message }}
@enderror
</span>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<label for="notes" class="form-label">Notes</label>
<textarea class="form-control" rows=3 name="notes" placeholder="Notes..." @cannot('admin',$o)disabled @endcannot>{{ old('notes',$o->notes) }}</textarea>
</div>
</div>
<div class="row">
<div class="col-12">
<a href="{{ url('ftn/filearea') }}" class="btn btn-danger">Cancel</a>
@can('admin',$o)
<button type="submit" name="submit" class="btn btn-success float-end">@if ($o->exists)Save @else Add @endif</button>
@endcan
</div>
</div>
</div>
</div>
</div>
</form>
@endsection

View File

@ -0,0 +1,68 @@
@extends('layouts.app')
@section('htmlheader_title')
Fileareas
@endsection
@section('content')
<div class="row">
<div class="col-12">
<h2>About Fileareas</h2>
<p>BBS Systems exchange area able to exchange and distribute files. Files are grouped into <strong class="highlight">fileareas</strong> normally around a theme or type.</p>
<p>Each filerea has a unique <strong class="highlight">filetag</strong> which helps a receiving BBS to know where to store the file when it is received.</p>
</div>
</div>
<div class="row">
<div class="col-6">
<p>This system is aware of the following fileareas:</p>
@if (\App\Models\Filearea::count() == 0)
@can('admin',(new \App\Models\Filearea))
<p>There are no fileareas setup, to <a href="{{ url('ftn/filearea/addedit') }}">set up your first</a>.</p>
@else
<p class="pad">There are no fileareas - you need to ask an admin to create one for you.</p>
@endcan
@else
<table class="table monotable">
<thead>
<tr>
<th>ID</th>
<th>Filetag</th>
<th>Description</th>
<th>Active</th>
<th>Domain</th>
</tr>
</thead>
<tbody>
@can('admin',(new \App\Models\Filearea))
<tr>
<td colspan="5"><a href="{{ url('ftn/filearea/addedit') }}">Add New Filearea</a></td>
</tr>
@endcan
@foreach (\App\Models\Filearea::orderBy('name')->with(['domain'])->get() as $oo)
<tr>
<td><a href="{{ url('ftn/filearea/addedit',[$oo->id]) }}">{{ $oo->id }}</a></td>
<td>{{ $oo->name }}</td>
<td>{{ $oo->description }}</td>
<td>{{ $oo->active ? 'YES' : 'NO' }}</td>
<td>{{ $oo->domain->name }}</td>
</tr>
@endforeach
</tbody>
</table>
@endif
</div>
</div>
@endsection
@section('page-scripts')
<script type="text/javascript">
$('table tr').click(function() {
var href = $(this).find('a').attr('href');
if (href)
window.location = href;
});
</script>
@append

View File

@ -6,6 +6,8 @@
<dd><a href="{{ url('ftn/domain') }}">Domains</a></dd> <dd><a href="{{ url('ftn/domain') }}">Domains</a></dd>
<dd><a href="{{ url('ftn/system') }}">Systems</a></dd> <dd><a href="{{ url('ftn/system') }}">Systems</a></dd>
<dd><a href="{{ url('ftn/zone') }}">Zones</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>
</dl> </dl>
<dl> <dl>

View File

@ -3,7 +3,13 @@
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Route; use Illuminate\Support\Facades\Route;
use App\Http\Controllers\{HomeController,DomainController,NodeController,SystemController,UserController,ZoneController}; use App\Http\Controllers\{HomeController,
DomainController,
EchoareaController,
FileareaController,
SystemController,
UserController,
ZoneController};
use App\Http\Controllers\Auth\LoginController; use App\Http\Controllers\Auth\LoginController;
/* /*
@ -35,6 +41,14 @@ Route::middleware(['verified','activeuser'])->group(function () {
Route::match(['get','post'],'ftn/domain/addedit/{o?}',[DomainController::class,'add_edit']) Route::match(['get','post'],'ftn/domain/addedit/{o?}',[DomainController::class,'add_edit'])
->where('o','[0-9]+'); ->where('o','[0-9]+');
Route::get('ftn/echoarea',[EchoareaController::class,'home']);
Route::match(['get','post'],'ftn/echoarea/addedit/{o?}',[EchoareaController::class,'add_edit'])
->where('o','[0-9]+');
Route::get('ftn/filearea',[FileareaController::class,'home']);
Route::match(['get','post'],'ftn/filearea/addedit/{o?}',[FileareaController::class,'add_edit'])
->where('o','[0-9]+');
Route::get('ftn/system',[SystemController::class,'home']); Route::get('ftn/system',[SystemController::class,'home']);
Route::match(['get','post'],'ftn/system/addedit/{o?}',[SystemController::class,'add_edit']) Route::match(['get','post'],'ftn/system/addedit/{o?}',[SystemController::class,'add_edit'])
->where('o','[0-9]+'); ->where('o','[0-9]+');