From 038169336785593541cce93398850c2229ad836c Mon Sep 17 00:00:00 2001 From: Banana Date: Sun, 25 Apr 2021 22:32:48 +0200 Subject: [PATCH] some sort improvements --- webclient/.htaccess | 3 +++ webclient/api.php | 3 ++- webclient/lib/managecollectionfields.class.php | 6 ++++++ webclient/lib/mancubus.class.php | 8 +++++--- webclient/lib/trite.class.php | 6 ++++++ webclient/view/default/collections/collections.html | 8 ++++---- webclient/view/default/collections/collections.php | 4 ++++ webclient/view/default/dashboard/dashboard.html | 2 +- 8 files changed, 31 insertions(+), 9 deletions(-) create mode 100644 webclient/.htaccess diff --git a/webclient/.htaccess b/webclient/.htaccess new file mode 100644 index 0000000..67415bb --- /dev/null +++ b/webclient/.htaccess @@ -0,0 +1,3 @@ +# memory_limit > post_max_size > upload_max_filesize +php_value upload_max_filesize 10M +php_value post_max_size 20M diff --git a/webclient/api.php b/webclient/api.php index ce077a6..6e2cbbc 100644 --- a/webclient/api.php +++ b/webclient/api.php @@ -151,6 +151,7 @@ switch ($_requestMode) { if(!empty($_collection)) { $_msg = 'Invalid POST data.'; + $_data = $_REQUEST; $Mancubus = new Mancubus($DB,$Doomguy); $ManangeEntry = new Manageentry($DB,$Doomguy); @@ -189,7 +190,7 @@ switch ($_requestMode) { if(!empty($do)) { $_msg = 'Added entry: '.$_fieldsToSave['title']['valueToSave']; $_status = 200; - $_data = array(); + $_data = array($_fieldsToSave, $_owner, $_group, $_rights); } } } diff --git a/webclient/lib/managecollectionfields.class.php b/webclient/lib/managecollectionfields.class.php index 510a419..6136778 100644 --- a/webclient/lib/managecollectionfields.class.php +++ b/webclient/lib/managecollectionfields.class.php @@ -288,6 +288,8 @@ class ManageCollectionFields { * Every field witch has a column in the entry table is a simple search field. * Name starts with entry * + * @see Trite->getSimpleSearchFields() + * * @return array */ public function getSimpleSearchFields(): array { @@ -302,6 +304,10 @@ class ManageCollectionFields { } } + $def['created'] = array('identifier' => 'created', 'displayname' => 'Created', 'type' => 'systemfield'); + $def['modified'] = array('identifier' => 'modified', 'displayname' => 'Modified', 'type' => 'systemfield'); + $ret = $def + $ret; + return $ret; } diff --git a/webclient/lib/mancubus.class.php b/webclient/lib/mancubus.class.php index 61df841..676ec4e 100644 --- a/webclient/lib/mancubus.class.php +++ b/webclient/lib/mancubus.class.php @@ -256,7 +256,7 @@ class Mancubus { $queryOrder .= ' '.$this->_queryOptions['sortDirection']; } else { - $queryOrder .= " DESC"; + $queryOrder .= " ASC"; } } @@ -380,7 +380,7 @@ class Mancubus { $queryOrder .= ' '.$this->_queryOptions['sortDirection']; } else { - $queryOrder .= " DESC"; + $queryOrder .= " ASC"; } $queryLimit = ''; @@ -531,7 +531,9 @@ class Mancubus { catch (Exception $e) { error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage()); } - $ret = $this->_cacheLookupValuesForEntry[$this->_collectionId][$entryId][$fieldData['id']]; + if(isset($this->_cacheLookupValuesForEntry[$this->_collectionId][$entryId][$fieldData['id']])) { + $ret = $this->_cacheLookupValuesForEntry[$this->_collectionId][$entryId][$fieldData['id']]; + } } } diff --git a/webclient/lib/trite.class.php b/webclient/lib/trite.class.php index 17eb17d..2761d53 100644 --- a/webclient/lib/trite.class.php +++ b/webclient/lib/trite.class.php @@ -231,6 +231,8 @@ class Trite { * Every field witch has a column in the entry table is a simple search field. * Name starts with entry * + * @see ManageCollectionFields->getSimpleSearchFields() + * * @return array */ public function getSimpleSearchFields(): array { @@ -245,6 +247,10 @@ class Trite { } } + $def['created'] = array('identifier' => 'created', 'displayname' => 'Created', 'type' => 'systemfield'); + $def['modified'] = array('identifier' => 'modified', 'displayname' => 'Modified', 'type' => 'systemfield'); + $ret = $def + $ret; + return $ret; } diff --git a/webclient/view/default/collections/collections.html b/webclient/view/default/collections/collections.html index 7d49c42..5deea3c 100644 --- a/webclient/view/default/collections/collections.html +++ b/webclient/view/default/collections/collections.html @@ -11,16 +11,16 @@
diff --git a/webclient/view/default/collections/collections.php b/webclient/view/default/collections/collections.php index 2b2082a..5906b50 100644 --- a/webclient/view/default/collections/collections.php +++ b/webclient/view/default/collections/collections.php @@ -93,12 +93,16 @@ if(!empty($_collection)) { $TemplateData['defaultSortField'] = $defaultSortField = $Trite->param('defaultSortField'); $TemplateData['simpleSearchFields'] = $Trite->getSimpleSearchFields(); + if(!empty($_queryOptions['sort'])) { + $TemplateData['simpleSearchFields'][$_queryOptions['sort']]['selected'] = true; + } if(!empty($TemplateData['defaultSortField'])) { unset($TemplateData['simpleSearchFields'][$TemplateData['defaultSortField']]); if(empty($_queryOptions['sort'])) { $_queryOptions['sort'] = $TemplateData['defaultSortField']; } } + $Mancubus->setQueryOptions($_queryOptions); $TemplateData['storagePath'] = PATH_WEB_STORAGE . '/' . $Trite->param('id'); diff --git a/webclient/view/default/dashboard/dashboard.html b/webclient/view/default/dashboard/dashboard.html index 196cade..642919e 100644 --- a/webclient/view/default/dashboard/dashboard.html +++ b/webclient/view/default/dashboard/dashboard.html @@ -36,7 +36,7 @@

- +

-- 2.39.5