]> 91.132.146.200 Git - bibliotheca-php.git/commitdiff
adnvanced search has table view now
authorBanana <mail@bananas-playground.net>
Sun, 4 Apr 2021 10:12:12 +0000 (12:12 +0200)
committerBanana <mail@bananas-playground.net>
Sun, 4 Apr 2021 10:12:12 +0000 (12:12 +0200)
13 files changed:
CHANGELOG
TODO
documentation/setup/bibliotheca.sql
documentation/upgrade.txt
upgrade/from-version-1.0.txt
webclient/lib/managecollections.class.php
webclient/lib/mancubus.class.php
webclient/lib/summoner.class.php
webclient/lib/trite.class.php
webclient/view/default/advancedsearch/advancedsearch.html
webclient/view/default/advancedsearch/advancedsearch.php
webclient/view/default/managecolletions/managecolletions.html
webclient/view/default/managecolletions/managecolletions.php

index e65a485f54308a2e142d942940421f2113a7bb0e..b062176469c4d16bf271910e049a4e3377af7335 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -27,6 +27,8 @@
                Upload fields are not supported yet.
        * Fixed bug #5
        * Added feature #1. Collections overview has pagination at the bottom too.
+       * Advanced search has a table view option
+               Displayed fields are configured in collection management. See notes there.
 
 1.0 - Castle 20210106
        * First usable version
diff --git a/TODO b/TODO
index 3720f2cd83fa0350b8265f388079f22718c14014..45d21679d09255331edd447c974d0109c9d520de 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,3 +1,4 @@
+* Update install sql file
 * stats overview page. amount of entries. file / cache and db storage. Version info and where to find it.
 * User and groupmanagement: Check where a user or group is used!
 * Better error handling and display while adding / update and delete
index 19f88b3c6bb9cc17cfcadd7296373b9dae10c900..8d1e7b9abf368217247997a662054fb033471608 100644 (file)
@@ -34,12 +34,14 @@ CREATE TABLE `#REPLACEME#_collection` (
   `name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
   `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
   `defaultSearchField` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
+  `defaultSortField` varchar(16) COLLATE utf8mb4_unicode_ci NOT NULL,
+  `advancedSearchTableFields` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
   `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
   `modified` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
   `modificationuser` int DEFAULT NULL,
   `owner` int NOT NULL,
   `group` int NOT NULL,
-  `rights` char(9) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL
+  `rights` char(9) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
 
 -- --------------------------------------------------------
@@ -87,7 +89,8 @@ CREATE TABLE `#REPLACEME#_menu` (
   `group` int NOT NULL DEFAULT '0',
   `rights` char(9) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
   `position` int NOT NULL DEFAULT '0',
-  `category` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL
+  `category` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
+   PRIMARY KEY (`id`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
 
 --
@@ -106,9 +109,11 @@ INSERT INTO `#REPLACEME#_menu` (`id`, `text`, `action`, `icon`, `owner`, `group`
 (10, 'Collection fields', 'managecollectionfields', '', 1, 2, 'rw-rw----', 0, ''),
 (11, 'Entry', 'entry', '', 1, 1, 'rw-r--r--', 0, ''),
 (12, 'Search', 'search', '', 1, 1, 'rw-r--r--', 0, ''),
-(14, 'Tool', 'tool', '', 1, 1, 'rw-------', 0, ''),
-(15, 'Profile', 'profile', 'user', 1, 2, 'rw-rw----', 5, 'manage'),
-(16, 'Groups', 'managegroups', 'users', 1, 1, 'rw-------', 6, 'manage');
+(14, 'Tool', 'tool', '', 1, 2, 'rw-rw----', 0, ''),
+(15, 'Advanced search', 'advancedsearch', '', 1, 1, 'rw-r--r--', 0, ''),
+(16, 'Profile', 'profile', 'user', 1, 2, 'rw-rw----', 6, 'manage'),
+(17, 'Groups', 'managegroups', 'users', 1, 1, 'rw-------', 5, 'manage'),
+(18, 'Bulkedit', 'bulkedit', '', 1, 2, 'rw-rw----', 0, '');
 
 -- --------------------------------------------------------
 
@@ -348,7 +353,7 @@ ALTER TABLE `#REPLACEME#_group`
 -- AUTO_INCREMENT for table `#REPLACEME#_menu`
 --
 ALTER TABLE `#REPLACEME#_menu`
-  MODIFY `id` int UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17;
+  MODIFY `id` int UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=19;
 
 --
 -- AUTO_INCREMENT for table `#REPLACEME#_sys_fields`
index ecf4489a8cb89047ed181ace09e788c1112163dd..645bdfbd8a3325561f0a712515b90e747dcae27e 100644 (file)
@@ -2,3 +2,5 @@ Each release has its own file in the upgrade folder.
 In this file there are the steps needed to make an upgrade.
 
 If you upgrade multiple versions make sure to read all the files in the correct order.
+
+Within the upgrade note files there is an order. Make sure to follow.
index 70a927dc3279d1d42a9b8e058dbf991747db1af0..d71d0d3ee20694c767c1e76cf165c81bec0fff95 100644 (file)
@@ -1,20 +1,20 @@
-# Migration of the config files into one config file
+#1 Migration of the config files into one config file
 Please copy the new config/config.php.default to config/config.php and adapt the settings which you
 have on the old config files. After that you can delete config/database|path|system files.
 
-# Deletion of config definition
+#2 Deletion of config definition
 The definition of USER_DEFAULT_RIGHTS_STRING can be removed from config file.
 
-# New config file
+#3 New config file
 Copy config/config-imdbweb.php.default to config/config-imdbweb.php
 See too-imdbweb.txt documentation for more information.
 
-# following files can be removed
+#4 following files can be removed
 view/default/system/pagination.html
 view/default/system/pagination_after.php
 view/default/system/pagination_before.php
 
-# DB changes. Run each line against your bibliotheca DB.
+#5 DB changes. Run each line against your bibliotheca DB.
 # Replace #REPLACEME# with your table prefix. Default is bib
 UPDATE `#REPLACEME#_menu` SET `rights` = 'rw-rw----' WHERE `#REPLACEME#_menu`.`id` = 10;
 UPDATE `#REPLACEME#_menu` SET `group` = '2' WHERE `#REPLACEME#_menu`.`id` = 10;
@@ -32,3 +32,8 @@ UPDATE `#REPLACEME#_sys_fields` SET `inputValidation` = 'allowSpace' WHERE `bib_
 UPDATE `#REPLACEME#_sys_fields` SET `inputValidation` = 'allowSpace' WHERE `bib_sys_fields`.`id` = 8;
 UPDATE `#REPLACEME#_sys_fields` SET `inputValidation` = 'allowSpace' WHERE `bib_sys_fields`.`id` = 20;
 UPDATE `#REPLACEME#_sys_fields` SET `inputValidation` = 'allowSpace' WHERE `bib_sys_fields`.`id` = 26;
+ALTER TABLE `#REPLACEME#_collection` ADD `advancedSearchTableFields` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL AFTER `defaultSortField`;
+ALTER TABLE `#REPLACEME#_sys_fields` ADD UNIQUE (`identifier`);
+
+# 6
+Update your collection settings. There are new options which should be set.
index 69e02672b838272953f88ba32df2a4795d97b056..5e0898d38969f5644b61a006e96aef15d0dcf554 100644 (file)
@@ -214,7 +214,8 @@ class ManageCollections {
                                                                `group` = '".$this->_DB->real_escape_string($data['group'])."',
                                                                `rights` = '".$this->_DB->real_escape_string($data['rights'])."',
                                                                `defaultSearchField` = '".$this->_DB->real_escape_string($data['defaultSearchField'])."',
-                                                               `defaultSortField` = '".$this->_DB->real_escape_string($data['defaultSortField'])."'";
+                                                               `defaultSortField` = '".$this->_DB->real_escape_string($data['defaultSortField'])."',
+                                                               `advancedSearchTableFields` = '".$this->_DB->real_escape_string($data['advancedSearchTableFields'])."'";
                                if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
                                $this->_DB->query($queryStr);
                                $newId = $this->_DB->insert_id;
@@ -281,7 +282,7 @@ class ManageCollections {
                if (Summoner::validate($id, 'digit')) {
                        $queryStr = "SELECT `c`.`id`, `c`.`name`, `c`.`description`, `c`.`created`,
                                        `c`.`owner`, `c`.`group`, `c`.`rights`, `c`.`defaultSearchField`,
-                                       `c`.`defaultSortField`,
+                                       `c`.`defaultSortField`, `c`.`advancedSearchTableFields`,
                                        `u`.`name` AS username, `g`.`name` AS groupname
                                        FROM `".DB_PREFIX."_collection` AS c
                                        LEFT JOIN `".DB_PREFIX."_user` AS u ON `c`.`owner` = `u`.`id`
@@ -295,6 +296,7 @@ class ManageCollections {
                                        $ret = $query->fetch_assoc();
                                        $ret['rights'] = Summoner::prepareRightsArray($ret['rights']);
                                        $ret['tool'] = $this->getAvailableTools($id);
+                                       $ret['advancedSearchTableFields'] = $this->_loadAdvancedSearchTableFields($ret['advancedSearchTableFields']);
                                }
                        }
                        catch (Exception $e) {
@@ -328,7 +330,8 @@ class ManageCollections {
                                                        `group` = '".$this->_DB->real_escape_string($data['group'])."',
                                                        `rights` = '".$this->_DB->real_escape_string($data['rights'])."',
                                                        `defaultSearchField` = '".$this->_DB->real_escape_string($data['defaultSearchField'])."',
-                                                       `defaultSortField` = '".$this->_DB->real_escape_string($data['defaultSortField'])."'
+                                                       `defaultSortField` = '".$this->_DB->real_escape_string($data['defaultSortField'])."',
+                                                       `advancedSearchTableFields` = '".$this->_DB->real_escape_string($data['advancedSearchTableFields'])."'
                                                WHERE `id` = '".$this->_DB->real_escape_string($data['id'])."'";
                        if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
                        try {
@@ -558,6 +561,14 @@ class ManageCollections {
                return $ret;
        }
 
+       /**
+        * Update the rights from the group to the entries in this collection
+        *
+        * @param string $collectionId
+        * @param string|bool $owner
+        * @param string|bool $group
+        * @param string|bool $rights
+        */
        private function _updateEntryRights($collectionId, $owner=false, $group=false, $rights=false) {
                if(!empty($collectionId)) {
                        $queryStr = "UPDATE `".DB_PREFIX."_collection_entry_".$collectionId."` SET";
@@ -582,4 +593,21 @@ class ManageCollections {
                        }
                }
        }
+
+       /**
+        * Make a key=>value array of a comma seperated string and use the value as key
+        *
+        * @param array $data
+        * @return array
+        */
+       private function _loadAdvancedSearchTableFields($data) {
+               $ret = array();
+
+               $_t = explode(',',$data);
+               foreach($_t as $e) {
+                       $ret[$e] = $e;
+               }
+
+               return $ret;
+       }
 }
index a9d65e6d4ad09be2f3637e3c4bd04b722c70dd97..61df841e8c5242563f68f2aa5be0c472814cfe85 100644 (file)
@@ -206,7 +206,7 @@ class Mancubus {
                        if(!empty($searchData)) {
                                // this search supports fulltext search and number <> search.
                                // also can search in the entry2lookup table.
-                               // not perfect but works really well
+                               // not perfect but it works
                                foreach($searchData as $k=>$sd) {
                                        if(!isset($sd['colName']) || !isset($sd['colValue']) || empty($sd['colValue'])) continue;
 
index 70b8489d83d747a1ca1d0bf90a634a90e26b8144..86133f452cf2ae10d00a4a5c569c543557e03ee1 100644 (file)
@@ -610,12 +610,26 @@ class Summoner {
         *
         * http://php.net/manual/en/migration70.new-features.php#migration70.new-features.null-coalesce-op
         *
-        * @param $array
-        * @param $key
+        * @param array $array
+        * @param array|string $key
         * @return bool|mixed
         */
        static function ifset($array,$key) {
-               return isset($array[$key]) ? $array[$key] : false;
+               if(is_array($key)) {
+                       $_t = $array;
+                       $_c = 0;
+                       foreach ($key as $k) {
+                               if(isset($_t[$k])) {
+                                       $_t = $_t[$k];
+                                       $_c++;
+                               }
+                       }
+
+                       return sizeof($key)==$_c ? $_t : false;
+
+               } else {
+                       return isset($array[$key]) ? $array[$key] : false;
+               }
        }
 
        /**
@@ -679,4 +693,22 @@ class Summoner {
 
                return $ret;
        }
+
+       /**
+        * Return given string with given $endChar with the max $length
+        *
+        * @param string $string
+        * @param int $length
+        * @param string $endChar
+        * @return string
+        */
+       static function limitWithDots($string, $length, $endChar) {
+               $ret = $string;
+
+               if(strlen($string.$endChar) > $length) {
+                       $ret = substr($string,0, $length).$endChar;
+               }
+
+               return $ret;
+       }
 }
index 718a7565ece70fa4c4e00e0fcc1e2ca923b3f5d6..17eb17d1296b792c50dd22426375fc5448b4c31a 100644 (file)
@@ -118,7 +118,7 @@ class Trite {
 
                        $queryStr = "SELECT `c`.`id`, `c`.`name`, `c`.`description`, `c`.`created`,
                                        `c`.`owner`, `c`.`group`, `c`.`rights`, `c`.`defaultSearchField`,
-                                       `c`.`defaultSortField`,
+                                       `c`.`defaultSortField`,`c`.`advancedSearchTableFields`,
                                        `u`.`name` AS username, `g`.`name` AS groupname
                                        FROM `".DB_PREFIX."_collection` AS c
                                        LEFT JOIN `".DB_PREFIX."_user` AS u ON `c`.`owner` = `u`.`id`
@@ -130,6 +130,7 @@ class Trite {
                                $query = $this->_DB->query($queryStr);
                                if ($query !== false && $query->num_rows > 0) {
                                        $this->_collectionData = $query->fetch_assoc();
+                                       $this->_collectionData['advancedSearchTableFields'] = $this->_loadAdvancedSearchTableFields($this->_collectionData['advancedSearchTableFields']);
                                        $this->_id = $this->_collectionData['id'];
                                }
                        } catch (Exception $e) {
@@ -340,4 +341,21 @@ class Trite {
                $options['sortDirection'] = false;
                $this->setQueryOptions($options);
        }
+
+       /**
+        * Make a key=>value array of a comma seperated string and use the value as key
+        *
+        * @param array $data
+        * @return array
+        */
+       private function _loadAdvancedSearchTableFields($data) {
+               $ret = array();
+
+               $_t = explode(',',$data);
+               foreach($_t as $e) {
+                       $ret[$e] = $e;
+               }
+
+               return $ret;
+       }
 }
index 13ec271fdf5ac74f694a8c1be12f57ee7376f26d..a352fa07f0b8ec10c0acba64df1830fc820403c0 100644 (file)
@@ -5,28 +5,29 @@
        <button class="uk-alert-close" type="button" uk-close></button>
        <p>Display result for: <b><?php echo $TemplateData['search']; ?></b> (Max. result of 60)</p>
 </div>
-<script type="text/javascript">
-       UIkit.util.on('#searchNotice', 'hide', function () {
-               window.location.href="index.php?p=advancedsearch&collection=<?php echo $TemplateData['loadedCollection']['id']; ?>";
-       });
-</script>
-<button class="uk-button uk-button-default uk-button-small"
-        type="button" uk-toggle="target: #searchFrame; animation: uk-animation-scale-down; cls: uk-hidden">Toggle search</button>
-<?php if(!empty($TemplateData['entries'])) { ?>
-<form method="post" action="index.php?p=bulkedit&collection=<?php echo $TemplateData['loadedCollection']['id']; ?>" class="uk-display-inline-block">
-       <button type="submit" class="uk-button uk-button-default uk-button-small">Bulkedit these results</button>
-       <?php foreach($TemplateData['entries']['ids'] as $f) { ?>
-       <input type="hidden" name="bulkedit[]" value="<?php echo $f; ?>" />
+<div class="uk-padding-small uk-padding-remove-left">
+       <script type="text/javascript">
+               UIkit.util.on('#searchNotice', 'hide', function () {
+                       window.location.href="index.php?p=advancedsearch&collection=<?php echo $TemplateData['loadedCollection']['id']; ?>";
+               });
+       </script>
+       <button class="uk-button uk-button-default uk-button-small"
+               type="button" uk-toggle="target: #searchFrame; animation: uk-animation-scale-down; cls: uk-hidden">Toggle search</button>
+       <?php if(!empty($TemplateData['entries'])) { ?>
+       <form method="post" action="index.php?p=bulkedit&collection=<?php echo $TemplateData['loadedCollection']['id']; ?>" class="uk-display-inline-block">
+               <button type="submit" class="uk-button uk-button-default uk-button-small">Bulkedit these results</button>
+               <?php foreach($TemplateData['entries']['ids'] as $f) { ?>
+               <input type="hidden" name="bulkedit[]" value="<?php echo $f; ?>" />
+               <?php } ?>
+       </form>
        <?php } ?>
-</form>
-<?php } ?>
+</div>
 
 <?php } ?>
 
 <div class="uk-grid-small uk-grid-row-small uk-grid-row-small <?php if(!empty($TemplateData['search'])) { ?>uk-hidden<?php } ?>"
        uk-grid id="searchFrame">
        <div class="uk-width-1-2">
-
                <form class="uk-form-horizontal uk-margin-small" method="post">
                        <div class="uk-margin">
                                <label class="uk-form-label" for="search">Search for</label>
                                               placeholder="See search syntax for options">
                                </div>
                        </div>
+                       <div class="uk-margin">
+                               <div class="uk-form-label">Table view</div>
+                               <div class="uk-form-controls uk-form-controls-text">
+                                       <label>
+                                               <input class="uk-checkbox" type="checkbox" name="fdata[tableView]" value="1">
+                                       </label>
+                               </div>
+                       </div>
 
                        <div class="uk-margin">
                                <button class="uk-button uk-button-primary" type="submit" name="submitForm">
        <div class="uk-width-1-2">
                <h4>Syntax</h4>
                <p>To search within the collection default search field, like the ordinary search, just type the search term and go.</p>
-               <p>To search within the possible fields of a collection type the field identifier followed by : and then a space. Not every search operator does make sense with tag search fields.</p>
+               <p>
+                       To search within the possible fields of a collection type the field identifier followed by : and then a space. Not every search operator does make sense with tag search fields.
+                       If the search is within a field witch is not configured to be displayed in the table view, it will be added.
+               </p>
                eg.: <code>title: bourne</code>
                <p>Available fields in <b><?php echo Summoner::ifset($TemplateData['loadedCollection'], 'name'); ?></b> are:</p>
                <pre style="white-space: normal">
 </div>
 
 <?php if(!empty($TemplateData['entries'])) { ?>
-<div class="uk-grid-small uk-grid-match" uk-grid>
+<div>
+       <?php if($TemplateData['searchResultStyle'] == "table") { ?>
+
+       <table class="uk-table uk-table-small uk-table-divider uk-table-justify">
+               <thead>
+                       <tr>
+                               <th class="">#</th>
+                       <?php
+                               foreach($TemplateData['collectionFields'] as $f) {
+                                       if(in_array($f['id'],$TemplateData['loadedCollection']['advancedSearchTableFields'])) {
+                                               echo '<th>'.$f['displayname'].'</th>';
+                                       }
+                               }
+                       ?>
+                       </tr>
+               </thead>
+               <tbody>
+
        <?php foreach($TemplateData['entries']['results'] as $entryK=>$entry) { ?>
+               <tr>
+                       <td class="">
+                               <a href="<?php echo $TemplateData['entryLinkPrefix']; ?>&id=<?php echo $entryK; ?>" target=_blank><span class="" uk-icon="icon: link"></span></a>
+                       </td>
+
+               <?php
+               foreach($entry['fields'] as $f) {
+                       if(in_array($f['id'],$TemplateData['loadedCollection']['advancedSearchTableFields'])) {
+               ?>
+                       <td>
+                               <?php
+                               if(Summoner::ifset($f, 'value')) {
+                                       if(is_array($f['value'])) {
+                                               echo Summoner::limitWithDots(implode(', ',$f['value']),100,'...');
+                                       }
+                                       else {
+                                               echo Summoner::limitWithDots($f['value'],100,'...');
+                                       }
+                               }
+                               ?>
+                       </td>
+               <?php
+                   }
+               }
+               ?>
+               </tr>
+       <?php } ?>
+               </tbody>
+       </table>
+</div>
+       <?php
+       } else {
+       ?>
+<div class="uk-grid-small uk-grid-match" uk-grid>
+       <?php foreach($TemplateData['entries']['results'] as $entryK=>$entry) { ?>
        <div class="uk-width-1-4@s uk-width-1-6@l">
                <div class="uk-card uk-card-default uk-card-small">
                        <div class="uk-card-media-top">
                                <?php if(Summoner::ifset($entry['fields'], 'coverimage')) { ?>
-                               <a href="<?php echo $TemplateData['entryLinkPrefix']; ?>&id=<?php echo $entryK; ?>">
+                               <a href="<?php echo $TemplateData['entryLinkPrefix']; ?>&id=<?php echo $entryK; ?>" target=_blank>
                                <img src="<?php echo $TemplateData['storagePath'].'/'.$entryK.'/'.$entry['fields']['coverimage']['value']; ?>"
                                     alt="<?php echo $entry['fields']['coverimage']['displayname']; ?>">
                                </a>
                                <?php } ?>
                        </div>
                        <div class="uk-card-footer">
-                               <a href="<?php echo $TemplateData['entryLinkPrefix']; ?>&id=<?php echo $entryK; ?>" class="uk-button uk-button-text">View</a>
+                               <a href="<?php echo $TemplateData['entryLinkPrefix']; ?>&id=<?php echo $entryK; ?>" class="uk-button uk-button-text" target=_blank>View</a>
                        </div>
                </div>
        </div>
-       <?php } ?>
+       <?php
+               }
+       }
+       ?>
 </div>
 <?php } ?>
 
index 5ce42ca18bb9be0f9fe8f6a99cb2a0fca1e3f9e7..45ea518cb62d0b14fb7b5b9c72288e727f3b0506 100644 (file)
@@ -32,6 +32,7 @@ $TemplateData['loadedCollection'] = array();
 $TemplateData['collections'] = array();
 $TemplateData['collectionFields'] = array();
 $TemplateData['search'] = false;
+$TemplateData['searchResultStyle'] = 'grid';
 
 if(!empty($_collection)) {
        $TemplateData['loadedCollection'] = $Trite->load($_collection);
@@ -48,6 +49,10 @@ if(!empty($_collection)) {
                        if (!empty($fdata)) {
                                $_search = trim($fdata['search']);
 
+                               if(isset($fdata['tableView'])) {
+                                       $TemplateData['searchResultStyle'] = 'table';
+                               }
+
                                if (!empty($_search) && Summoner::validate($_search)) {
                                        if (strstr($_search, ':')) { // field search
                                                $_matches = array();
@@ -64,6 +69,10 @@ if(!empty($_collection)) {
                                                                        $_sData[$i]['colName'] = $_cn;
                                                                        $_sData[$i]['colValue'] = trim(str_replace($_matches[1][$i],'',$_matches[0][$i]));
                                                                        $_sData[$i]['fieldData'] = $TemplateData['collectionFields'][$_cn];
+
+                                                                       if(!isset($TemplateData['loadedCollection']['advancedSearchTableFields'][$_sData[$i]['fieldData']['id']])) {
+                                                                               $TemplateData['loadedCollection']['advancedSearchTableFields'][$_sData[$i]['fieldData']['id']] = $_sData[$i]['fieldData']['id'];
+                                                                       }
                                                                }
                                                        }
 
index a0eeee1a3a53efafd0e3a66ced793b48b790b557..513b17a65135434d2f0bf53d0e17105be2bd4326 100644 (file)
                                        </select>
                                </div>
                        </div>
+                       <div class="uk-margin">
+                               <label class="uk-form-label" for="advancedSearchTableFields">Table advanced search view</label>
+                               <div class="uk-form-controls">
+                                       <select class="uk-select" id="advancedSearchTableFields" name="fdata[advancedSearchTableFields][]" multiple="multiple" size="5">
+                                               <?php foreach($TemplateData['existingFields'] as $k=>$v) { ?>
+                                               <option value="<?php echo $v['id']; ?>"
+                                               <?php if(Summoner::ifset($TemplateData['editData']['advancedSearchTableFields'], $v['id'])) echo 'selected'; ?>
+                                               ><?php echo $v['displayname']; ?> (<?php echo $v['type']; ?>)</option>
+                                               <?php } ?>
+                                       </select>
+                                       <small>Make sure that the default global search field is in this list.<br />
+                                               This does not limit the fields to search in.</small>
+                               </div>
+                       </div>
                        <div class="uk-margin">
                                <label class="uk-form-label" for="tool">Tools</label>
                                <div class="uk-form-controls">
index d9c134457e8b8719eb54e88eb0dd55a34222e349..1dd057ea66ff74ecaf431487794a171859292fb1 100644 (file)
@@ -67,8 +67,8 @@ if(isset($_POST['submitForm'])) {
                $_saveData['owner'] = trim($fdata['owner']);
                $_saveData['group'] = trim($fdata['group']);
                $_saveData['rights'] = Summoner::prepareRightsString($fdata['rights']);
-               $_saveData['defaultSearchField'] = trim($fdata['defaultSearchField']);
-               $_saveData['defaultSortField'] = trim($fdata['defaultSortField']);
+               $_saveData['defaultSearchField'] = $fdata['defaultSearchField'];
+               $_saveData['defaultSortField'] = $fdata['defaultSortField'];
                $_saveData['id'] = $_id;
 
                $_saveData['tool'] = array();
@@ -81,6 +81,11 @@ if(isset($_POST['submitForm'])) {
                        $_saveData['doRightsForEntries'] = true;
                }
 
+               $_saveData['advancedSearchTableFields'] = '';
+               if(isset($fdata['advancedSearchTableFields'])) {
+                       $_saveData['advancedSearchTableFields'] = implode(',',$fdata['advancedSearchTableFields']);
+               }
+
                if(!empty($TemplateData['editData']['name'])) { // EDIT
                        if(isset($fdata['doDelete'])) {
                                $do = $ManangeCollections->deleteCollection($_id);