diff --git a/app/Http/Controllers/DomainController.php b/app/Http/Controllers/DomainController.php index 886c772..2e33b18 100644 --- a/app/Http/Controllers/DomainController.php +++ b/app/Http/Controllers/DomainController.php @@ -20,12 +20,13 @@ class DomainController extends Controller { if ($request->post()) { $request->validate([ - 'name' => 'required|unique:domains|max:8', - 'dnsdomain' => 'nullable|unique:domains|regex:/^(?!:\/\/)(?=.{1,255}$)((.{1,63}\.){1,127}(?![0-9]*$)[a-z0-9-]+\.?)$/i', + 'name' => 'required|max:8|unique:domains,name,'.$o->id, + 'dnsdomain' => 'nullable|regex:/^(?!:\/\/)(?=.{1,255}$)((.{1,63}\.){1,127}(?![0-9]*$)[a-z0-9-]+\.?)$/i|unique:domains,dnsdomain,'.$o->id, 'active' => 'required', + 'public' => 'required', ]); - foreach (['name','dnsdomain','active','notes'] as $key) + foreach (['name','dnsdomain','active','public','homepage','notes'] as $key) $o->{$key} = $request->post($key); $o->save(); diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 028a629..51dc6e3 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -2,12 +2,13 @@ namespace App\Http\Controllers; +use App\Models\Domain; + class HomeController extends Controller { - public function network(string $name) + public function network(Domain $o) { - return view('networks') - ->with('content',$name) - ->with('network',$name); + return view('domain.view') + ->with('o',$o); } } \ No newline at end of file diff --git a/app/Models/Domain.php b/app/Models/Domain.php index f5bbfe6..2b6f160 100644 --- a/app/Models/Domain.php +++ b/app/Models/Domain.php @@ -10,10 +10,32 @@ class Domain extends Model { use ScopeActive; + /* SCOPES */ + + /** + * Only query active records + */ + public function scopePublic($query) + { + return $query->where('public',TRUE); + } + /* RELATIONS */ public function zones() { return $this->hasMany(Zone::class); } + + /* CASTS */ + + public function getHomePageAttribute($value) + { + return $value ? gzuncompress(base64_decode($value)) : 'No available information at the moment.'; + } + + public function setHomePageAttribute($value) + { + $this->attributes['homepage'] = base64_encode(gzcompress($value,9)); + } } \ No newline at end of file diff --git a/app/Models/Zone.php b/app/Models/Zone.php index 29ace2e..245b90f 100644 --- a/app/Models/Zone.php +++ b/app/Models/Zone.php @@ -17,13 +17,5 @@ class Zone extends Model return $this->belongsTo(Domain::class); } - /* SCOPES */ - /** - * Only query active records - */ - public function scopePublic() - { - return $this->where('public',TRUE); - } } \ No newline at end of file diff --git a/app/Traits/ScopeActive.php b/app/Traits/ScopeActive.php index 08f44f9..d140dc7 100644 --- a/app/Traits/ScopeActive.php +++ b/app/Traits/ScopeActive.php @@ -10,8 +10,8 @@ trait ScopeActive /** * Only query active records */ - public function scopeActive() + public function scopeActive($query) { - return $this->where($this->getTable().'.active',TRUE); + return $query->where($this->getTable().'.active',TRUE); } } diff --git a/database/migrations/2021_06_14_064423_add_public_to_domains.php b/database/migrations/2021_06_14_064423_add_public_to_domains.php new file mode 100644 index 0000000..ddc2a43 --- /dev/null +++ b/database/migrations/2021_06_14_064423_add_public_to_domains.php @@ -0,0 +1,40 @@ +boolean('public')->default(TRUE); + $table->text('homepage')->nullable(); + }); + + Schema::table('zones', function (Blueprint $table) { + $table->dropColumn('public'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('domains', function (Blueprint $table) { + $table->dropColumn(['public','homepage']); + }); + Schema::table('zones', function (Blueprint $table) { + $table->boolean('public')->default(TRUE); + }); + } +} diff --git a/public/oldschool/css/main.css b/public/oldschool/css/main.css index 5363d12..0b578d9 100644 --- a/public/oldschool/css/main.css +++ b/public/oldschool/css/main.css @@ -41,6 +41,9 @@ textarea { a:link { text-decoration:none } +a.disabled { + pointer-events: none; +} .cap { text-transform:uppercase @@ -261,6 +264,11 @@ ul#navlist-desktop { text-shadow: 2px 2px 0 #555; border-bottom: 2px solid #aaa; } +#content h1>small { + font-size: 35%; + color: #403f3f; + text-shadow: none; +} #content h2 { color:#fff; background-color:#a00; @@ -298,10 +306,7 @@ ul#navlist-desktop { color:#c60; } -#content>div.row:first-child { - padding-top: 0px; -} -#content>div.row { +#content>div.row:not(:first-child) { padding-top: 20px; } @@ -412,6 +417,9 @@ form div.row { .greyframe>form>div.row:last-child { padding-bottom: 15px; } +.greyframe div.row div[class^="col-"]:not(:first-child) { + padding-left: 20px; +} label.form-label { font-size: 75%; @@ -458,6 +466,23 @@ div p:last-child { margin: auto; } +pre, +pre code { + font-family:ibmbios2y,monospace; + font-size:14px; + color: #ccc; + margin:0; + padding: 0 0 20px 0; + font-weight:400; + text-align:left; + white-space:pre-wrap; + white-space:-moz-pre-wrap; + white-space:-pre-wrap; + white-space:-o-pre-wrap; + word-wrap:break-word; + text-indent:initial +} + .row { text-align: left; } @@ -549,6 +574,9 @@ tbody { border-bottom:1px solid #666 } +.push-right { + float:right; +} .text-center { text-align:center; } diff --git a/resources/views/about.blade.php b/resources/views/about.blade.php index 6821138..c6b72d8 100644 --- a/resources/views/about.blade.php +++ b/resources/views/about.blade.php @@ -1,4 +1,7 @@ @extends('layouts.app') +@section('htmlheader_title') + About +@endsection @section('content')

About the FTN Clearing House

diff --git a/resources/views/domain/addedit.blade.php b/resources/views/domain/addedit.blade.php index 94dadfe..82b7eba 100644 --- a/resources/views/domain/addedit.blade.php +++ b/resources/views/domain/addedit.blade.php @@ -5,16 +5,16 @@ @endsection @section('content') -
-
-
-

@if($o->exists) Update @else Add @endif Domain

+
+ @csrf - - @csrf +
+
+
+

@if($o->exists) Update @else Add @endif Domain

-
+
@@ -30,25 +30,8 @@ @enderror
-
-
-
- -
- - - @error('dnsdomain') - - {{ $message }} - - @enderror -
-
-
- -
-
+
@@ -63,20 +46,77 @@
-
- - +
+ +
+ + + @error('dnsdomain') + + {{ $message }} + + @enderror +
+
+ +
+ +
+
+ public)checked @endif> + + + public)checked @endif> + +
+
+
+
+ more text
- Cancel - + +
- +
-
+ +
+
+
+

Home Page

+ +
+
+ +
+ +
+
+
+
+ +
+
+ Cancel + +
+
+
+
+ @endsection + +@section('page-scripts') + + + + +@append \ No newline at end of file diff --git a/resources/views/domain/home.blade.php b/resources/views/domain/home.blade.php index 01c5aec..cf19150 100644 --- a/resources/views/domain/home.blade.php +++ b/resources/views/domain/home.blade.php @@ -1,4 +1,7 @@ @extends('layouts.app') +@section('htmlheader_title') + FTN Domains +@endsection @section('content')
@@ -32,7 +35,7 @@ Add New Domain - @foreach (\App\Models\Domain::cursor() as $oo) + @foreach (\App\Models\Domain::orderBy('name')->cursor() as $oo) {{ $oo->id }} {{ $oo->active ? 'YES' : 'NO' }} diff --git a/resources/views/layouts/partials/topmenu.blade.php b/resources/views/layouts/partials/topmenu.blade.php index 6a99a6b..7591b7a 100644 --- a/resources/views/layouts/partials/topmenu.blade.php +++ b/resources/views/layouts/partials/topmenu.blade.php @@ -4,7 +4,7 @@ -
diff --git a/resources/views/zone/home.blade.php b/resources/views/zone/home.blade.php index 40df805..0769dab 100644 --- a/resources/views/zone/home.blade.php +++ b/resources/views/zone/home.blade.php @@ -1,4 +1,7 @@ @extends('layouts.app') +@section('htmlheader_title') + FTN Zones +@endsection @section('main-content')
diff --git a/routes/web.php b/routes/web.php index 1999692..9fe5cad 100644 --- a/routes/web.php +++ b/routes/web.php @@ -44,4 +44,6 @@ Route::middleware(['verified'])->group(function () { ->where('o','[0-9]+'); Route::get('ftn/network/{name}',[HomeController::class,'network']); -}); \ No newline at end of file +}); + +Route::get('network/{o}',[HomeController::class,'network']); \ No newline at end of file