From: Banana Date: Fri, 1 Jan 2021 00:04:15 +0000 (+0100) Subject: advanced search X-Git-Tag: 1.0~39 X-Git-Url: http://91.132.146.200/gitweb/?a=commitdiff_plain;h=848371a76fe3b56875c2245f1c89198f0a23f13e;p=bibliotheca-php.git advanced search --- diff --git a/TODO b/TODO index 158d4ec..3b080a4 100644 --- a/TODO +++ b/TODO @@ -9,4 +9,4 @@ * delete of a collection * sort by filter for collection display * responsive and breakpoints -* Advanced search. More options and searchable fields +* DB query log and optimization diff --git a/documentation/fields.txt b/documentation/fields.txt new file mode 100644 index 0000000..3302111 --- /dev/null +++ b/documentation/fields.txt @@ -0,0 +1,47 @@ +TBD + +Bibliotheca provides a set of fields which can be used to define which data an entry in your collection +can be saved. +Those field definitions are stored in the DB itself and can currently only managed there. But only of +you know how. + +Each collection can have there own set of fields. But at least the title field should be available. +Fields can be managed after a collection has been created. + + +# If you want to create new ones here is a explanation how they work +A field is defined in the sys_fields table. It needs a _saveField and optinal _loadFieldValue method +in manageentry.class and the _loadFieldValue also in mancubus.class +HTML definitions are needed in view/UI_THEME/entry and view/UI_THEME/manageentry +Modification on advancedsearch.php if search needs some special treatment for this field + +# Fields on sys_fields table +Have a look into the table. Special ones are described here. + +identifier +Unique string within the how sys_fields table. + +displayname +Text which will be displayed for this field. + +type +Specifies the type which then lets the code "know" what to do with this field. +Needs a html definition in view/UI_THEME/entry and view/UI_THEME/manageentry. +A _loadFieldValue_TYPE method in manageentry.class and mancubus.class if it needs special data process reading +A _saveField_TYPE method in manageentry.class for data saving. +Modification on advancedsearch.php if search needs some special treatment for this field + +searchtype +- tag = releation to lookup2entry table +- entryText = text col in entry table +- entrySingleText = entry col in entry table. Single value +- entrySingleNum = entry col in entry table. Number. Single value. Can be searched by with >< + +createstring +The SQL create string which is run as you add it to your collection. Not everyone needs one! + +value +The value which is displayed as a selection for the user. Needed for a selection type field + +apiinfo +Text description what type of data the api expects if you want to fill this field. diff --git a/documentation/setup/bibliotheca.sql b/documentation/setup/bibliotheca.sql index 23b61aa..2194ab3 100644 --- a/documentation/setup/bibliotheca.sql +++ b/documentation/setup/bibliotheca.sql @@ -134,18 +134,17 @@ CREATE TABLE `#REPLACEME#_sys_fields` ( -- INSERT INTO `#REPLACEME#_sys_fields` (`id`, `identifier`, `displayname`, `type`, `searchtype`, `createstring`, `value`, `apiinfo`, `created`, `modificationuser`, `owner`, `group`, `rights`) VALUES -(1, 'title', 'Title', 'text', 'text', '`title` varchar(128) NOT NULL', NULL, 'string 128', '2019-09-01 18:26:33', 0, 1, 1, 'rw-r--r--'), -(2, 'description', 'Description', 'text3', 'text', '`description` varchar(255) NULL DEFAULT NULL', NULL, 'string 64', '2019-09-01 18:28:35', 0, 1, 1, 'rw-r--r--'), -(3, 'content', 'Main content', 'textarea', 'text', 'content` text NULL DEFAULT NULL,', NULL, 'mysql text', '2019-09-01 18:28:35', 0, 1, 1, 'rw-r--r--'), -(4, 'releasedate', 'Release date', 'date', 'text', '`releasedate` timestamp NULL DEFAULT NULL', NULL, 'mysql timestamp', '2019-09-01 19:01:39', 0, 1, 1, 'rw-r--r--'), +(1, 'title', 'Title', 'text', 'entryText', '`title` varchar(128) NOT NULL, ADD FULLTEXT (`title`)', NULL, 'string 128', '2019-09-01 18:26:33', 0, 1, 1, 'rw-r--r--'), +(2, 'description', 'Description', 'text3', 'entryText', '`description` varchar(255) NULL DEFAULT NULL, ADD FULLTEXT (`description`)', NULL, 'string 255', '2019-09-01 18:28:35', 0, 1, 1, 'rw-r--r--'), +(3, 'content', 'Main content', 'textarea', 'entryText', '`content` text NULL DEFAULT NULL, ADD FULLTEXT (`content`)', NULL, 'mysql text', '2019-09-01 18:28:35', 0, 1, 1, 'rw-r--r--'), (5, 'tag', 'Tag', 'lookupmultiple', 'tag', NULL, NULL, 'string 64', '2019-09-01 19:11:18', 0, 1, 1, 'rw-r--r--'), (6, 'category', 'Category', 'lookupmultiple', 'tag', NULL, NULL, 'string 64', '2019-09-01 19:11:18', 0, 1, 1, 'rw-r--r--'), (7, 'publisher', 'Publisher', 'lookupmultiple', 'tag', NULL, NULL, 'string 64', '2019-09-01 19:17:51', 0, 1, 1, 'rw-r--r--'), (8, 'developer', 'Developer', 'lookupmultiple', 'tag', NULL, NULL, 'string 64', '2019-09-01 19:17:51', 0, 1, 1, 'rw-r--r--'), (9, 'platform', 'Platform', 'selection', 'tag', '`platform` varchar(32) NULL DEFAULT NULL', 'PC,Xbox,Playstation,Nintendo,Nintendo Switch', 'One of PC,Xbox,Playstation,Nintendo,Nintendo Switch', '2019-09-01 19:18:33', 0, 1, 1, 'rw-r--r--'), (10, 'storage', 'Storage', 'lookupmultiple', 'tag', NULL, NULL, 'string 64', '2019-09-01 19:18:33', 0, 1, 1, 'rw-r--r--'), -(13, 'rating', 'Rating', 'selection', 'tag', '`rating` varchar(16) NULL DEFAULT NULL', '0/10,2/10,3/10,4/10,5/10,6/10,7/10,8/10,9/10,10/10', 'One of 0/10,2/10,3/10,4/10,5/10,6/10,7/10,8/10,9/10,10/10', '2019-09-01 19:25:35', 0, 1, 1, 'rw-r--r--'), -(14, 'year', 'Year', 'year', 'tag', '`year` year NULL DEFAULT NULL', NULL, 'mysql year', '2019-09-01 19:30:11', 0, 1, 1, 'rw-r--r--'), +(13, 'rating', 'Rating', 'selection', 'entrySingleText', '`rating` varchar(16) NULL DEFAULT NULL', '0/10,2/10,3/10,4/10,5/10,6/10,7/10,8/10,9/10,10/10', 'One of 0/10,2/10,3/10,4/10,5/10,6/10,7/10,8/10,9/10,10/10', '2019-09-01 19:25:35', 0, 1, 1, 'rw-r--r--'), +(14, 'year', 'Year', 'year', 'entrySingleText', '`year` year NULL DEFAULT NULL', NULL, 'mysql year', '2019-09-01 19:30:11', 0, 1, 1, 'rw-r--r--'), (15, 'coverimage', 'Cover image', 'upload', NULL, NULL, NULL, 'One file in $_FILES[uploads] of post', '2019-09-01 19:48:44', 0, 1, 1, 'rw-r--r--'), (16, 'attachment', 'Attachments', 'upload_multiple', NULL, NULL, NULL, 'Multiple in $_FILES[uploads] of post', '2019-09-01 19:48:44', 0, 1, 1, 'rw-r--r--'), (17, 'os', 'Operating system and version', 'selection', 'tag', '`os` varchar(32) NULL DEFAULT NULL', 'Windows 10,Windows 95, Windows 99,Windows XP, Windows ME, Windows 2000,Windows Vista,Windows 8', 'One of Windows 10,Windows 95, Windows 99,Windows XP, Windows ME, Windows 2000,Windows Vista,Windows 8', '2019-09-01 19:55:13', 0, 1, 1, 'rw-r--r--'), @@ -154,9 +153,9 @@ INSERT INTO `#REPLACEME#_sys_fields` (`id`, `identifier`, `displayname`, `type`, (20, 'directors', 'Directors', 'lookupmultiple', 'tag', NULL, NULL, 'string 64', '2020-07-26 07:17:59', NULL, 1, 1, 'rw-r--r--'), (21, 'genres', 'Genres', 'lookupmultiple', 'tag', NULL, NULL, 'string 64', '2020-07-26 07:18:55', NULL, 1, 1, 'rw-r--r--'), (22, 'languages', 'Languages', 'lookupmultiple', 'tag', NULL, NULL, 'string 64', '2020-07-26 07:20:45', NULL, 1, 1, 'rw-r--r--'), -(23, 'runtime', 'Runtime', 'text', 'text', '`runtime` varchar(128) NULL DEFAULT NULL', NULL, 'string 128', '2020-07-26 07:22:24', NULL, 1, 1, 'rw-r--r--'), -(24, 'imdbrating', 'IMDB Rating', 'text', 'text', '`imdbrating` varchar(128) NULL DEFAULT NULL', NULL, 'string 128', '2020-12-27 10:00:33', 0, 1, 1, 'rw-r--r--'), -(25, 'viewcount', 'View counter', 'text', 'text', '`viewcount` varchar(128) NULL DEFAULT NULL', NULL, 'string 128', '2020-12-27 10:41:10', 0, 1, 1, 'rw-r--r--'); +(23, 'runtime', 'Runtime (min)', 'number', 'entrySingleNum', '`runtime` int(10) NULL, ADD INDEX (`runtime`)', NULL, 'int 10', '2020-07-26 07:22:24', NULL, 1, 1, 'rw-r--r--'), +(24, 'imdbrating', 'IMDB Rating', 'text', 'entrySingleText', '`imdbrating` varchar(128) NULL DEFAULT NULL', NULL, 'string 128', '2020-12-27 10:00:33', 0, 1, 1, 'rw-r--r--'), +(25, 'viewcount', 'View counter', 'number', 'entrySingleNum', '`viewcount` int(10) NULL, ADD INDEX (`viewcount`)', NULL, 'int 10', '2020-12-27 10:41:10', 0, 1, 1, 'rw-r--r--'); -- -------------------------------------------------------- diff --git a/webclient/config/path.php.default b/webclient/config/path.php.default index cd41577..d07a694 100644 --- a/webclient/config/path.php.default +++ b/webclient/config/path.php.default @@ -17,7 +17,7 @@ */ # path settings -define('PATH_ABSOLUTE','/home/banana/code/bibliotheca/webclient'); +define('PATH_ABSOLUTE','/home/some/path/bibliotheca/webclient'); define('PATH_SYSTEMOUT',PATH_ABSOLUTE.'/systemout'); define('PATH_STORAGE',PATH_ABSOLUTE.'/storage'); define('PATH_WEB_STORAGE','storage'); diff --git a/webclient/lib/manageentry.class.php b/webclient/lib/manageentry.class.php index 3e4956e..6f72d98 100644 --- a/webclient/lib/manageentry.class.php +++ b/webclient/lib/manageentry.class.php @@ -519,6 +519,17 @@ class Manageentry { return $this->_saveField_text($data, $queryData); } + /** + * Create part of the insert statement for field type number + * @param array $data + * @param array $queryData + * @return mixed + */ + private function _saveField_number($data, $queryData) { + $queryData['init'][] = "`".$data['identifier']."` = ".$this->_DB->real_escape_string($data['valueToSave']).""; + return $queryData; + } + /** * Create part of the insert statement for field type lookupmultiple * diff --git a/webclient/lib/mancubus.class.php b/webclient/lib/mancubus.class.php index faf8c99..224f604 100644 --- a/webclient/lib/mancubus.class.php +++ b/webclient/lib/mancubus.class.php @@ -129,8 +129,17 @@ class Mancubus { require_once 'lib/trite.class.php'; $_colObj = new Trite($this->_DB,$this->_User); $_colObj->load($result['id']); - - $result['entries'] = $_mObj->getEntries($_colObj->param('defaultSearchField'),$search,true); + $_fd = $_colObj->getCollectionFields(); + + $result['entries'] = $_mObj->getEntries( + array( + 0 => array( + 'colName' => $_colObj->param('defaultSearchField'), + 'colValue' => $search, + 'fieldData' => $_fd[$_colObj->param('defaultSearchField')] + ) + ) + ); } else { $result['entries'] = $_mObj->getEntries(); @@ -144,45 +153,76 @@ class Mancubus { } /** - * Get entries for loaded collection limited by search in - * given colName and colValue + * Get entries for loaded collection limited by search + * and already set query options + * + * array[0] => array( + * 'colName' => 'column name to search in', + * 'colValue' => 'Value to search for', + * 'fieldData' => field data from Trite->getCollectionFields() + * ) * - * @param string $colName Table col to search - * @param string $colValue Value to search in col - * @param bool $fulltext If col has a fulltext index use it. + * @param array $searchData * @return array */ - public function getEntries($colName='', $colValue='',$fulltext=false) { + public function getEntries($searchData=array()) { $ret = array(); if(!empty($this->_collectionId)) { // split since part of it is used later $querySelect = "SELECT *"; $queryFrom = " FROM `".DB_PREFIX."_collection_entry_".$this->_DB->real_escape_string($this->_collectionId)."` AS t"; + $queryJoin = ''; $queryWhere = " WHERE ".$this->_User->getSQLRightsString("read", "t").""; - if(!empty($colName) && !empty($colValue)) { - if($fulltext === true) { - $queryWhere .= " AND MATCH (`t`.`".$this->_DB->real_escape_string($colName)."`) - AGAINST ('".$this->_DB->real_escape_string($colValue)."' IN BOOLEAN MODE)"; - } - else { - $queryWhere .= " AND `t`.`" . $this->_DB->real_escape_string($colName) . "` = '" . $this->_DB->real_escape_string($colValue) . "'"; + $_isFulltext = false; + if(!empty($searchData)) { + // this search supports fulltext search and number <> search. + // also can search in the entry2lookup table. + // not perfect but works really well + foreach($searchData as $k=>$sd) { + if(!isset($sd['colName']) || !isset($sd['colValue']) || empty($sd['colValue'])) continue; + + if($sd['fieldData']['searchtype'] == "tag") { + $_isFulltext = true; + + $queryJoin = " LEFT JOIN `".DB_PREFIX."_collection_entry2lookup_".$this->_DB->real_escape_string($this->_collectionId)."` AS e2l ON e2l.fk_entry=t.id"; + + $queryWhere .= " AND e2l.fk_field = '".$this->_DB->real_escape_string($sd['fieldData']['id'])."'"; + $queryWhere .= " AND MATCH (e2l.value) AGAINST ('".$this->_DB->real_escape_string($sd['colValue'])."' IN BOOLEAN MODE)"; + } + elseif ($sd['fieldData']['searchtype'] == "entrySingleNum" && strstr($sd['colValue'],'<')) { + $_s = str_replace('<','',$sd['colValue']); + $queryWhere .= " AND `t`.`".$this->_DB->real_escape_string($sd['colName'])."` < ".(int)$_s.""; + } + elseif ($sd['fieldData']['searchtype'] == "entrySingleNum" && strstr($sd['colValue'],'>')) { + $_s = str_replace('>','',$sd['colValue']); + $queryWhere .= " AND `t`.`".$this->_DB->real_escape_string($sd['colName'])."` > ".(int)$_s.""; + } + elseif($sd['fieldData']['searchtype'] == "entryText") { + $_isFulltext = true; + $queryWhere .= " AND MATCH (`t`.`".$this->_DB->real_escape_string($sd['colName'])."`) + AGAINST ('".$this->_DB->real_escape_string($sd['colValue'])."' IN BOOLEAN MODE)"; + } + else { + $queryWhere .= " AND `t`.`".$this->_DB->real_escape_string($sd['colName'])."` = '".$this->_DB->real_escape_string($sd['colValue'])."'"; + } } } - $queryOrder = " ORDER BY"; - if(!empty($this->_queryOptions['sort'])) { - $queryOrder .= ' t.'.$this->_queryOptions['sort']; - } - else { - $queryOrder .= " t.created"; - } - if(!empty($this->_queryOptions['sortDirection'])) { - $queryOrder .= ' '.$this->_queryOptions['sortDirection']; - } - else { - $queryOrder .= " DESC"; + $queryOrder = ''; + if(!$_isFulltext) { // fulltext do not order. Which results in ordering be relevance of the match + $queryOrder = " ORDER BY"; + if (!empty($this->_queryOptions['sort'])) { + $queryOrder .= ' t.' . $this->_queryOptions['sort']; + } else { + $queryOrder .= " t.created"; + } + if (!empty($this->_queryOptions['sortDirection'])) { + $queryOrder .= ' ' . $this->_queryOptions['sortDirection']; + } else { + $queryOrder .= " DESC"; + } } $queryLimit = ''; @@ -194,9 +234,9 @@ class Mancubus { } } - if(DEBUG) error_log("[DEBUG] ".__METHOD__." data: ".$querySelect.$queryFrom.$queryWhere.$queryOrder.$queryLimit); + if(DEBUG) error_log("[DEBUG] ".__METHOD__." data: ".$querySelect.$queryFrom.$queryJoin.$queryWhere.$queryOrder.$queryLimit); - $query = $this->_DB->query($querySelect.$queryFrom.$queryWhere.$queryOrder.$queryLimit); + $query = $this->_DB->query($querySelect.$queryFrom.$queryJoin.$queryWhere.$queryOrder.$queryLimit); if($query !== false && $query->num_rows > 0) { $_entryFields = $this->_getEntryFields(); @@ -207,7 +247,7 @@ class Mancubus { $ret['results'][$result['id']] = $result; } - $query = $this->_DB->query("SELECT COUNT(t.id) AS amount ".$queryFrom.$queryWhere); + $query = $this->_DB->query("SELECT COUNT(t.id) AS amount ".$queryFrom.$queryJoin.$queryWhere); $result = $query->fetch_assoc(); $ret['amount'] = $result['amount']; } @@ -227,7 +267,7 @@ class Mancubus { if(!empty($this->_collectionId) && !empty($entryId)) { $queryStr = "SELECT * FROM `".DB_PREFIX."_collection_entry_".$this->_DB->real_escape_string($this->_collectionId)."` - WHERE ".$this->_User->getSQLRightsString("read")." + WHERE ".$this->_User->getSQLRightsString()." AND `id` = '".$this->_DB->real_escape_string($entryId)."'"; $query = $this->_DB->query($queryStr); @@ -254,7 +294,7 @@ class Mancubus { $ret = array(); $fieldData = array(); - $queryStr = "SELECT `identifier`, `type` FROM `".DB_PREFIX."_sys_fields` + $queryStr = "SELECT `identifier`, `type`, `id`, `searchtype` FROM `".DB_PREFIX."_sys_fields` WHERE `id` = '".$this->_DB->real_escape_string($fieldId)."'"; $query = $this->_DB->query($queryStr); if($query !== false && $query->num_rows > 0) { @@ -266,7 +306,16 @@ class Mancubus { if(empty($fieldData)) return $ret; if($fieldData['type'] !== "lookupmultiple") { - return $this->getEntries($fieldData['identifier'], $fieldValue); + return $this->getEntries( + array( + 0 => array( + 'colName' => $fieldData['identifier'], + 'colValue' => $fieldValue, + 'fieldData' => $fieldData + ) + ) + ); + } $querySelect = "SELECT `fk_entry`"; diff --git a/webclient/lib/trite.class.php b/webclient/lib/trite.class.php index 65cc390..3edfd7d 100644 --- a/webclient/lib/trite.class.php +++ b/webclient/lib/trite.class.php @@ -184,7 +184,8 @@ class Trite { public function getCollectionFields() { $ret = array(); - $queryStr = "SELECT `cf`.`fk_field_id` AS id, `sf`.`type`, `sf`.`displayname`, `sf`.`identifier` + $queryStr = "SELECT `cf`.`fk_field_id` AS id, `sf`.`type`, `sf`.`displayname`, `sf`.`identifier`, + `sf`.`searchtype` FROM `".DB_PREFIX."_collection_fields_".$this->_id."` AS cf LEFT JOIN `".DB_PREFIX."_sys_fields` AS sf ON `cf`.`fk_field_id` = `sf`.`id` ORDER BY `cf`.`sort`"; @@ -192,7 +193,7 @@ class Trite { try { if($query !== false && $query->num_rows > 0) { while(($result = $query->fetch_assoc()) != false) { - $ret[$result['id']] = $result; + $ret[$result['identifier']] = $result; } } } catch (Exception $e) { diff --git a/webclient/view/default/advancedsearch/advancedsearch.html b/webclient/view/default/advancedsearch/advancedsearch.html index 4bf643e..c89c046 100644 --- a/webclient/view/default/advancedsearch/advancedsearch.html +++ b/webclient/view/default/advancedsearch/advancedsearch.html @@ -1,5 +1,21 @@ -
+ + +
+ +

Display result for: (Max. result of 60)

+
+ + + + +
@@ -22,7 +38,7 @@

Syntax

To search within the collection default search field, like the ordinary search, just type the search term and go.

To search within the possible fields of a collection type the field identifier followed by : and then a space.

- eg.: title: starwars + eg.: title: bourne

Available fields in are:

 		+ = A leading plus sign indicates that this word must be present in each row that is returned.

- = A leading minus sign indicates that this word must not be present in any of the rows that are returned.

" = A phrase that is enclosed within double quote (") characters matches only rows that contain the phrase literally, as it was typed.

+

> = A leading greater than sign indicates that rows greater than the number will be returned.

+

< = A leading less than sign indicates that rows smaller than the number will be returned.

+ + +
+ $entry) { ?> +
+
+
+ + <?php echo $entry['fields']['coverimage']['displayname']; ?> + + +
+
+ +

+ + + +

+ +
+ +
+
+ +
+ +

Collection overview

diff --git a/webclient/view/default/advancedsearch/advancedsearch.php b/webclient/view/default/advancedsearch/advancedsearch.php index b3fbb4d..baefff0 100644 --- a/webclient/view/default/advancedsearch/advancedsearch.php +++ b/webclient/view/default/advancedsearch/advancedsearch.php @@ -18,6 +18,8 @@ require_once 'lib/trite.class.php'; $Trite = new Trite($DB,$Doomguy); +require_once 'lib/mancubus.class.php'; +$Mancubus = new Mancubus($DB,$Doomguy); $_collection = false; if(isset($_GET['collection']) && !empty($_GET['collection'])) { @@ -28,11 +30,64 @@ if(isset($_GET['collection']) && !empty($_GET['collection'])) { $TemplateData['loadedCollection'] = array(); $TemplateData['collections'] = array(); $TemplateData['collectionFields'] = array(); +$TemplateData['search'] = false; + +// if(!empty($_collection)) { $TemplateData['loadedCollection'] = $Trite->load($_collection); if(!empty($TemplateData['loadedCollection'])) { $TemplateData['collectionFields'] = $Trite->getCollectionFields(); + $Mancubus->setCollection($Trite->param('id')); + $Mancubus->setQueryOptions(array('limit' => 60)); + + $TemplateData['storagePath'] = PATH_WEB_STORAGE . '/' . $Trite->param('id'); + $TemplateData['entryLinkPrefix'] = "index.php?p=entry&collection=".$Trite->param('id'); + + if(isset($_POST['submitForm'])) { + $fdata = $_POST['fdata']; + if (!empty($fdata)) { + $_search = trim($fdata['search']); + + if (!empty($_search) && Summoner::validate($_search)) { + if (strstr($_search, ':')) { // field search + $_matches = array(); + if(preg_match_all("/(\p{L}+:)(?(?!\p{L}+:).)*/u",$_search, $_matches) !== false && !empty($_matches[0])) { + // $matches[0] has the identifier: and text + // $matches[1] has only the identifier: + // $matches[0][0] belongs to $matches[1][0] and so on + + $_sData = array(); + $_ms = count($_matches[0]); + for($i=0;$i<$_ms;$i++) { + $_cn = trim(str_replace(':','',$_matches[1][$i])); + $_sData[$i]['colName'] = $_cn; + $_sData[$i]['colValue'] = trim(str_replace($_matches[1][$i],'',$_matches[0][$i])); + $_sData[$i]['fieldData'] = $TemplateData['collectionFields'][$_cn]; + } + + $TemplateData['entries'] = $Mancubus->getEntries($_sData); + $TemplateData['search'] = $_search; + } + else { + $TemplateData['message']['content'] = "Wrong input format."; + $TemplateData['message']['status'] = "error"; + } + } else { // ordinary search within default field + $TemplateData['entries'] = $Mancubus->getEntries( + array( + 0 => array( + 'colName' => $Trite->param('defaultSearchField'), + 'colValue' => $_search, + 'fieldData' => $TemplateData['collectionFields'][$Trite->param('defaultSearchField')] + ) + ) + ); + $TemplateData['search'] = $_search; + } + } + } + } } else { $TemplateData['message']['content'] = "Can not load given collection."; diff --git a/webclient/view/default/collections/collections.php b/webclient/view/default/collections/collections.php index 6d36390..dd10b1c 100644 --- a/webclient/view/default/collections/collections.php +++ b/webclient/view/default/collections/collections.php @@ -63,9 +63,9 @@ if(!empty($_collection)) { if(!empty($TemplateData['loadedCollection'])) { $Mancubus->setCollection($Trite->param('id')); $Mancubus->setQueryOptions($_queryOptions); // this comes from pagination_before! - $TemplateData['storagePath'] = PATH_WEB_STORAGE . '/' . $_collection; - $TemplateData['entryLinkPrefix'] = "index.php?p=entry&collection=".$_collection; - $TemplateData['searchAction'] = 'index.php?p=collections&collection='.$_collection; + $TemplateData['storagePath'] = PATH_WEB_STORAGE . '/' . $Trite->param('id'); + $TemplateData['entryLinkPrefix'] = "index.php?p=entry&collection=".$Trite->param('id'); + $TemplateData['searchAction'] = 'index.php?p=collections&collection='.$Trite->param('id'); if (!empty($_fv) && !empty($_fid)) { $TemplateData['entries'] = $Mancubus->getEntriesByFieldValue($_fid, $_fv); @@ -74,7 +74,16 @@ if(!empty($_collection)) { $TemplateData['pagination']['currentGetParameters']['fid'] = $_fid; $TemplateData['pagination']['currentGetParameters']['fv'] = $_fv; } else { - $TemplateData['entries'] = $Mancubus->getEntries($Trite->param('defaultSearchField'),$_search,true); + $_fd = $Trite->getCollectionFields(); + $TemplateData['entries'] = $Mancubus->getEntries( + array( + 0 => array( + 'colName' => $Trite->param('defaultSearchField'), + 'colValue' => $_search, + 'fieldData' =>$_fd[$Trite->param('defaultSearchField')] + ) + ) + ); if (!empty($_search)) { $TemplateData['search'] = $_search; } diff --git a/webclient/view/default/entry/field-number.html b/webclient/view/default/entry/field-number.html new file mode 100644 index 0000000..951b94e --- /dev/null +++ b/webclient/view/default/entry/field-number.html @@ -0,0 +1,4 @@ +

+ : + +

diff --git a/webclient/view/default/manageentry/field-number.html b/webclient/view/default/manageentry/field-number.html new file mode 100644 index 0000000..fca6035 --- /dev/null +++ b/webclient/view/default/manageentry/field-number.html @@ -0,0 +1,9 @@ +
+ +
+ +
+