From b3dfeaba4021d91b778d348cd0d2e35d7372326e Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Sun, 3 May 2020 12:49:22 +0300 Subject: [PATCH] Addedf documents search --- app/init.php | 2 +- app/views/console/database/collection.phtml | 2 +- app/views/console/database/document.phtml | 57 +++++++++++---- app/views/console/database/rules/array.phtml | 2 +- .../console/database/rules/documentId.phtml | 13 ++-- .../console/database/search/documents.phtml | 71 +++++++++++++------ public/dist/scripts/app-all.js | 2 +- public/dist/scripts/app.js | 2 +- public/dist/styles/default-ltr.css | 2 +- public/dist/styles/default-rtl.css | 2 +- public/scripts/filters.js | 18 ----- public/scripts/views/forms/document.js | 31 +++----- public/styles/comps/box.less | 16 ++--- 13 files changed, 128 insertions(+), 92 deletions(-) diff --git a/app/init.php b/app/init.php index e609604c7..567b65066 100644 --- a/app/init.php +++ b/app/init.php @@ -32,7 +32,7 @@ const APP_EMAIL_SECURITY = 'security@localhost.test'; // Default security email const APP_USERAGENT = APP_NAME.'-Server v%s. Please report abuse at %s'; const APP_MODE_ADMIN = 'admin'; const APP_PAGING_LIMIT = 15; -const APP_CACHE_BUSTER = 119; +const APP_CACHE_BUSTER = 122; const APP_VERSION_STABLE = '0.5.3'; const APP_STORAGE_UPLOADS = '/storage/uploads'; const APP_STORAGE_CACHE = '/storage/cache'; diff --git a/app/views/console/database/collection.phtml b/app/views/console/database/collection.phtml index 54d22cdea..2a15b2d7c 100644 --- a/app/views/console/database/collection.phtml +++ b/app/views/console/database/collection.phtml @@ -102,7 +102,7 @@ $rules = $collection->getAttribute('rules', []); $type = (isset($rule['type'])) ? $rule['type'] : ''; $array = (isset($rule['array'])) ? $rule['array'] : ''; ?> - + +render(); ?> + + + getId()) { + continue; // Do not allow rec recrusion + } + + if(!isset($collections[$item])) { + Authorization::disable(); //TODO Try and avoid calling the DB from the template + $collections[$item] = $db->getDocument($item, false); + Authorization::reset(); + } + + $childCollection = $collections[$item]; + + if(!$childCollection->getId() || $childCollection->getCollection() !== Database::SYSTEM_COLLECTION_COLLECTIONS) { + continue; + } + + $searchDocuments + ->setParam('collection', $childCollection) + ; + + echo $searchDocuments->render(); ?> + + + getDocument($item, false); - Authorization::reset(); - - if(!$childCollection->getId()) { - continue; + if(!isset($collections[$item])) { + Authorization::disable(); //TODO Try and avoid calling the DB from the template + $collections[$item] = $db->getDocument($item, false); + Authorization::reset(); } - $collections[$childCollection->getId()] = $childCollection->getAttribute('name'); + $childCollection = $collections[$item]; + + if(!$childCollection->getId() || $childCollection->getCollection() !== Database::SYSTEM_COLLECTION_COLLECTIONS) { + continue; + } ?>
- - -render(); -echo $searchDocuments->render(); -?> \ No newline at end of file + \ No newline at end of file diff --git a/app/views/console/database/rules/array.phtml b/app/views/console/database/rules/array.phtml index 2550f8771..ae2600c6c 100644 --- a/app/views/console/database/rules/array.phtml +++ b/app/views/console/database/rules/array.phtml @@ -44,7 +44,7 @@ if($type === 'document') {
    getAttribute('name', '') : ''; ?>
  • diff --git a/app/views/console/database/rules/documentId.phtml b/app/views/console/database/rules/documentId.phtml index fa2a05e15..ae7d848b3 100644 --- a/app/views/console/database/rules/documentId.phtml +++ b/app/views/console/database/rules/documentId.phtml @@ -6,14 +6,17 @@ $collections = $this->getParam('collections', []); $array = $this->getParam('array', false); $list = $this->getParam('list', []); $list = (is_array($list)) ? $list : []; - -var_dump($collections); ?> \ No newline at end of file + class="margin-bottom-no"> + + + + + \ No newline at end of file diff --git a/app/views/console/database/search/documents.phtml b/app/views/console/database/search/documents.phtml index 6d85e539a..a27152262 100644 --- a/app/views/console/database/search/documents.phtml +++ b/app/views/console/database/search/documents.phtml @@ -1,15 +1,20 @@ +getParam('collection', []); +$id = $collection->getId(); +$name = $collection->getAttribute('name', 'Collection'); +$rules = $collection->getAttribute('rules', []); +?> - -