Skip to content

Commit

Permalink
thusfar
Browse files Browse the repository at this point in the history
  • Loading branch information
bobmagicii committed Jul 12, 2023
1 parent 3f7e8ca commit bee9cfc
Show file tree
Hide file tree
Showing 12 changed files with 282 additions and 130 deletions.
2 changes: 1 addition & 1 deletion app/www/share/atlantis/tag-dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ extends ModalDialog {

let api = new API.Request('TAGSGET', '/api/media/entity');

(api.send({ EntityUUID: this.uuid }))
(api.send({ EntityUUID: this.uuid, Type: this.type }))
.then(this.onTagFetch.bind(this))
.catch(api.catch);

Expand Down
2 changes: 1 addition & 1 deletion app/www/themes/default/area/tag/dashboard/list.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ $Surface
</div>
</div>
<div class="col">
<a href="<?php $Util->Print(sprintf('/tag/%s', $Tag->Alias)) ?>"><?php $Util->Print($Tag->Name) ?></a>
<a href="<?php $Util->Print($Tag->GetPageURL()) ?>"><?php $Util->Print($Tag->Name) ?></a>
</div>
<div class="col-auto">
<div class="btn btn-dark CmdTagEdit" data-tag-id="<?php $Util->Print($Tag->ID) ?>">
Expand Down
4 changes: 4 additions & 0 deletions app/www/themes/default/css/src/ext-bootstrap.css
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,10 @@
.line-clamp-7 { height: calc(var(--LocalLineHeight) * 7); }
.line-clamp-8 { height: calc(var(--LocalLineHeight) * 8); }

.dropdown-menu {
z-index: 9011;
}

.dropdown-menu.dropdown-menu-scrolled {
max-height: var(--DropdownMaxHeight);
overflow-y: scroll;
Expand Down
6 changes: 5 additions & 1 deletion app/www/themes/default/css/styles.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*//
@date 2023-07-11 22:30:18 UTC
@date 2023-07-12 01:25:38 UTC
@files 18 [
"src\/imports.css",
"src\/main.css",
Expand Down Expand Up @@ -465,6 +465,10 @@ strong {
.line-clamp-7 { height: calc(var(--LocalLineHeight) * 7); }
.line-clamp-8 { height: calc(var(--LocalLineHeight) * 8); }

.dropdown-menu {
z-index: 9011;
}

.dropdown-menu.dropdown-menu-scrolled {
max-height: var(--DropdownMaxHeight);
overflow-y: scroll;
Expand Down
3 changes: 2 additions & 1 deletion src/Nether/Atlantis/Library.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ public function

////////

Atlantis\Media\FileTagLink::RegisterType();
Atlantis\Media\FileTagLink::Register();
Atlantis\Tag\SubtagLink::Register();

////////

Expand Down
157 changes: 85 additions & 72 deletions src/Nether/Atlantis/Prototype.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,41 @@

namespace Nether\Atlantis;

use Nether\Atlantis;
use Nether\Common;
use Nether\Database;

#[Common\Meta\DateAdded('2023-02-15')]
#[Common\Meta\Info('Adds core object features that anything built using the framework should expect to have.')]
class Prototype
extends Database\Prototype {

////////////////////////////////////////////////////////////////
//// DATABASE FIELDS ///////////////////////////////////////////

#[Database\Meta\TypeIntBig(Unsigned: TRUE, AutoInc: TRUE)]
#[Database\Meta\PrimaryKey]
#[Common\Meta\PropertyListable]
#[Common\Meta\PropertyFilter([ Common\Filters\Numbers::class, 'IntType' ])]
public int
$ID;

#[Database\Meta\TypeChar(Size: 36)]
#[Database\Meta\FieldIndex]
#[Common\Meta\PropertyListable]
#[Common\Meta\PropertyFilter([ Common\Filters\Text::class, 'UUID' ])]
public string
$UUID;

////////
////////////////////////////////////////////////////////////////
//// LOCAL FIELDS //////////////////////////////////////////////

protected Database\Struct\PrototypeFindResult
$TagLinks;

////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
//// OVERRIDE Database\Prototype ///////////////////////////////

#[Common\Meta\DateAdded('2023-02-15')]
public function
Drop():
static {
Expand All @@ -45,116 +53,121 @@ public function
return $this;
}

////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////

public function
FetchTagLinks():
Database\Struct\PrototypeFindResult {

$Result = Tag\EntityLink::Find([
'EntityUUID' => $this->UUID
]);

return $Result;
}
#[Common\Meta\DateAdded('2023-02-15')]
static protected function
FindExtendFilters(Database\Verse $SQL, Common\Datastore $Input):
void {

public function
GetTagLinks():
Common\Datastore {
if(isset($Input['UUID'])) {
if(is_array($Input['UUID']))
$SQL->Where('Main.UUID IN(:UUID)');

if(!isset($this->TagLinks))
$this->TagLinks = $this->FetchTagLinks();
else
$SQL->Where('Main.UUID=:UUID');
}

return $this->TagLinks;
return;
}

public function
GetTags():
Common\Datastore {
#[Common\Meta\DateAdded('2023-02-15')]
static public function
Insert(iterable $Input):
?static {

$Links = $this->GetTagLinks();
$Input = Common\Datastore::FromStackBlended($Input, [
'UUID' => Common\UUID::V7()
]);

return $Links->Map(
fn(Tag\EntityLink $Link)
=> $Link->Tag
);
return parent::Insert($Input);
}

////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
//// LOCAL METHODS /////////////////////////////////////////////

#[Common\Meta\DateAdded('2023-05-09')]
#[Common\Meta\Info('Returns a dataset that is reasonable to be considered public information about this object. Classes should override, call the parent version, then append to the dataset returned.')]
public function
DescribeForPublicAPI():
array {

$Props = array_map(
(fn(Common\Prototype\PropertyInfo $P)=> $this->{$P->Name}),
static::GetPropertiesWithAttribute(
Common\Meta\PropertyListable::class
)
);
$Props = new Common\Datastore(static::GetPropertiesWithAttribute(
Common\Meta\PropertyListable::class
));

return $Props;
}
$Vals = $Props->Map(function(Common\Prototype\PropertyInfo $P) {

////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
$Attr = $P->GetAttribute(Common\Meta\PropertyListable::class);
/** @var Common\Meta\PropertyListable $Attr */

static public function
GetByUUID(string $UUID):
?static {
if(isset($Attr->MethodName))
if(method_exists($this->{$P->Name}, $Attr->MethodName))
return $this->{$P->Name}->{$Attr->MethodName}();

return parent::GetByField('UUID', $UUID);
if(isset($this->{$P->Name}))
return $this->{$P->Name};

return NULL;
});

return $Vals->GetData();
}

#[Common\Meta\DateAdded('2023-03-07')]
#[Common\Meta\Info('Fetch the dataset of tag links from the database.')]
public function
FetchTagLinks():
Database\Struct\PrototypeFindResult {

////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
$Result = Tag\EntityLink::Find([
'EntityUUID' => $this->UUID,
'Limit' => 0
]);

static protected function
FindExtendOptions(Common\Datastore $Input):
void {
return $Result;
}

#[Common\Meta\DateAdded('2023-03-07')]
#[Common\Meta\Info('Get the dataset of tag links from the database. Uses local instance cache.')]
public function
GetTagLinks():
Database\Struct\PrototypeFindResult {

if(!isset($this->TagLinks))
$this->TagLinks = $this->FetchTagLinks();

return;
return $this->TagLinks;
}

static protected function
FindExtendFilters(Database\Verse $SQL, Common\Datastore $Input):
void {

if(isset($Input['UUID'])) {
if(is_array($Input['UUID']))
$SQL->Where('Main.UUID IN(:UUID)');
#[Common\Meta\DateAdded('2023-03-07')]
#[Common\Meta\Info('Get the dataset of tag entities from the database. Uses local instance cache.')]
public function
GetTags():
Database\Struct\PrototypeFindResult {

else
$SQL->Where('Main.UUID=:UUID');
}
$Links = ($this
->GetTagLinks()
->Map(fn(Tag\EntityLink $Link)=> $Link->Tag)
);

return;
return $Links;
}

////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
//// LOCAL STATIC API //////////////////////////////////////////

#[Common\Meta\DateAdded('2023-05-23')]
#[Common\Meta\Info('Fetch an object by UUID.')]
static public function
Insert(iterable $Input):
GetByUUID(string $UUID):
?static {

$Input = new Common\Datastore($Input);

$Input->BlendRight([
'UUID' => ($Input['UUID'] ?: Common\UUID::V7())
]);

return parent::Insert($Input);
return parent::GetByField('UUID', $UUID);
}

////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
//// FILTER/MAPPER CALLABLES ///////////////////////////////////

#[Common\Meta\DateAdded('2023-07-07')]
static public function
MapForPublicAPI(self $Inst):
array {
Expand Down
4 changes: 3 additions & 1 deletion src/Nether/Atlantis/Routes/Media/EntityAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,12 @@ public function
void {

($this->Data)
->EntityUUID(Common\Datafilters::TrimmedText(...));
->EntityUUID(Common\Filters\Text::Trimmed(...))
->Type(Common\Filters\Text::TrimmedNullable(...));

$Result = Atlantis\Tag\EntityLink::Find([
'EntityUUID' => $this->Data->EntityUUID,
'Type' => $this->Data->Type,
'Sort' => 'tag-name-az',
'Limit' => 20
]);
Expand Down
8 changes: 2 additions & 6 deletions src/Nether/Atlantis/Routes/Media/TagAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,7 @@ public function

$Tag = $this->FetchTagByField();

$this->SetPayload([
'ID' => $Tag->ID,
'Type' => $Tag->Type,
'Alias' => $Tag->Alias,
'Name' => $Tag->Name
]);
$this->SetPayload($Tag->DescribeForPublicAPI());

return;
}
Expand All @@ -38,6 +33,7 @@ public function
->Query(Common\Datafilters::TrimmedText(...));

$Result = Atlantis\Tag\Entity::Find([
//'Type' => 'tag',
'NameLike' => $this->Data->Query,
'Sort' => 'tag-name-az',
'Limit' => 20
Expand Down
Loading

0 comments on commit bee9cfc

Please sign in to comment.