Tweaks to document access

This commit is contained in:
2024-06-03 18:18:51 -04:00
parent 93dd8e880f
commit 1ca7dbdedd
12 changed files with 107 additions and 30 deletions

View File

@@ -10,6 +10,7 @@ use BitBadger\Documents\JsonMapper;
use BitBadger\Documents\Query;
use BitBadger\Documents\SQLite\Custom;
use BitBadger\Documents\SQLite\Parameters;
use Iterator;
/**
* A list of items to be displayed
@@ -140,7 +141,7 @@ class ItemList
if ($isBookmarked) $fields[] = Data::bookmarkField(Table::ITEM);
$list = new static('Matching' . ($isBookmarked ? ' Bookmarked' : ''),
"/search?search=$search&items=" . ($isBookmarked ? 'bookmarked' : 'all'), $fields,
' ' . Table::ITEM . ".data->>'" . Configuration::idField() . "' IN "
' AND ' . Table::ITEM . ".data->>'" . Configuration::idField() . "' IN "
. '(SELECT ROWID FROM item_search WHERE content MATCH @search)');
$list->showIndicators = true;
$list->displayFeed = true;
@@ -159,8 +160,7 @@ class ItemList
$return = $this->returnURL == '' ? '' : '&from=' . urlencode($this->returnURL);
$hasItems = false;
echo '<article>';
iterator_apply($this->dbList->items(), function (ItemWithFeed $it) use (&$hasItems, $return)
{
foreach ($this->dbList->items() as $it) {
$hasItems = true;
echo '<p>' . hx_get("/item?id=$it->id$return", strip_tags($it->title)) . '<br><small>';
if ($this->showIndicators) {
@@ -176,7 +176,7 @@ class ItemList
echo ' &bull; ' . htmlentities($it->feed->title);
}
echo '</small>';
});
}
if (!$hasItems) {
echo '<p><em>There are no ' . strtolower($this->itemType) . ' items</em>';
}