]> 91.132.146.200 Git - bibliotheca-php.git/commitdiff
some sort improvements
authorBanana <mail@bananas-playground.net>
Sun, 25 Apr 2021 20:32:48 +0000 (22:32 +0200)
committerBanana <mail@bananas-playground.net>
Sun, 25 Apr 2021 20:32:48 +0000 (22:32 +0200)
webclient/.htaccess [new file with mode: 0644]
webclient/api.php
webclient/lib/managecollectionfields.class.php
webclient/lib/mancubus.class.php
webclient/lib/trite.class.php
webclient/view/default/collections/collections.html
webclient/view/default/collections/collections.php
webclient/view/default/dashboard/dashboard.html

diff --git a/webclient/.htaccess b/webclient/.htaccess
new file mode 100644 (file)
index 0000000..67415bb
--- /dev/null
@@ -0,0 +1,3 @@
+# memory_limit > post_max_size > upload_max_filesize
+php_value upload_max_filesize 10M
+php_value post_max_size 20M
index ce077a60fa3dd64d2ca855eca525ca2b26bbe807..6e2cbbc8d84ab95c973d7e7d44715e8270023627 100644 (file)
@@ -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);
                                        }
                                }
                        }
index 510a4199e92831c1fa2c7b616185207b07387a98..6136778582fcf4bf261d901de257244b7eafef00 100644 (file)
@@ -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;
        }
 
index 61df841e8c5242563f68f2aa5be0c472814cfe85..676ec4e2a94cb3acba204cae3a71d6f0a0f3ffd6 100644 (file)
@@ -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']];
+                               }
                        }
                }
 
index 17eb17d1296b792c50dd22426375fc5448b4c31a..2761d53a74ac169684c00fcbf9a1ae8e20d3c542 100644 (file)
@@ -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;
        }
 
index 7d49c4269254445efb6036d389a68837712a8ce6..5deea3c5ebc056bb2d43dca8e9dde6bf07238921 100644 (file)
                        <div uk-dropdown>
                                <ul class="uk-nav uk-dropdown-nav">
                                        <?php if(!empty($TemplateData['defaultSortField'])) { ?>
-                                       <li><a href="index.php?<?php echo Summoner::createFromParameterLinkQuery($TemplateData['pagination']['currentGetParameters'],array('s'=>$TemplateData['defaultSortField'],'sd'=>'DESC')); ?>">Default</a></li>
+                                       <li><a href="index.php?<?php echo Summoner::createFromParameterLinkQuery($TemplateData['pagination']['currentGetParameters'],array('s'=>$TemplateData['defaultSortField'],'sd'=>'ASC')); ?>">Default</a></li>
                                        <?php } else { ?>
-                                       <li><a href="index.php?<?php echo Summoner::createFromParameterLinkQuery($TemplateData['pagination']['currentGetParameters'],array('s'=>'','sd'=>'DESC')); ?>">Latest</a></li>
+                                       <li><a href="index.php?<?php echo Summoner::createFromParameterLinkQuery($TemplateData['pagination']['currentGetParameters'],array('s'=>'','sd'=>'ASC')); ?>">Latest</a></li>
                                        <?php } ?>
 
                                        <?php
                                        if(!empty($TemplateData['simpleSearchFields'])) {
                                                foreach($TemplateData['simpleSearchFields'] as $k=>$v) {
                                        ?>
-                                       <li><a href="index.php?<?php echo Summoner::createFromParameterLinkQuery($TemplateData['pagination']['currentGetParameters'],array('s'=>$k,'sd'=>'DESC')); ?>"><?php echo $v['displayname']; ?></a></li>
+                                       <li class="<?php if(isset($v['selected'])) echo 'uk-active' ?>"><a href="index.php?<?php echo Summoner::createFromParameterLinkQuery($TemplateData['pagination']['currentGetParameters'],array('s'=>$k,'sd'=>'ASC')); ?>"><?php echo $v['displayname']; ?></a></li>
                                        <?php
                                                }
                                        }
@@ -68,7 +68,7 @@
                                <h3 class="uk-card-title"><?php echo $entry['fields']['title']['value']; ?></h3>
                                <?php } ?>
 
-                               <?php if(Summoner::ifset($entry['fields'], 'description')) { ?>
+                               <?php if(Summoner::ifset($entry['fields'], array('description','value'))) { ?>
                                <p><?php echo $entry['fields']['description']['value']; ?></p>
                                <?php } ?>
                        </div>
index 2b2082a072174d106796c48cb7b8e6945a7db43b..5906b50403359c6499aea353bff302fb24b2a61b 100644 (file)
@@ -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');
index 196cadef451569c30f97353ddf3db2243bad650c..642919e80e2f2cf9928d228a8ae0bc9439b191e2 100644 (file)
@@ -36,7 +36,7 @@
                                        <h3 class="uk-card-title"><?php echo $entry['fields']['title']['value']; ?></h3>
                                        <?php } ?>
 
-                                       <?php if(Summoner::ifset($entry['fields'], 'description')) { ?>
+                                       <?php if(Summoner::ifset($entry['fields'], array('description','value'))) { ?>
                                        <p><?php echo $entry['fields']['description']['value']; ?></p>
                                        <?php } ?>
                                </div>