1.4 - Depths Of Rrajigar
+ * Added new default sort direction field in collection edit view. See upgrade file for more needed details
+ * Fixed #13
+ * Fixed Some layout alignements
1.3 - Rrajigar Mine 2022-10-08
* Fixed install sql file.
`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) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
+ `defaultSortOrder` varchar(4) CHARACTER SET utf8mb4 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,
--- /dev/null
+# DB changes. Run each line against your bibliotheca DB.
+# Replace #REPLACEME# with your table prefix. Default is bib
+ALTER TABLE `#REPLACEME#_collection` ADD `defaultSortOrder` VARCHAR(4) CHARACTER SET utf8mb4_unicode_ci COLLATE utf8mb4_bin NOT NULL AFTER `defaultSortField`;
`rights` = '".$this->_DB->real_escape_string($data['rights'])."',
`defaultSearchField` = '".$this->_DB->real_escape_string($data['defaultSearchField'])."',
`defaultSortField` = '".$this->_DB->real_escape_string($data['defaultSortField'])."',
+ `defaultSortOrder` = '".$this->_DB->real_escape_string($data['defaultSortOrder'])."',
`advancedSearchTableFields` = '".$this->_DB->real_escape_string($data['advancedSearchTableFields'])."'";
if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true));
$this->_DB->query($queryStr);
$queryStr = "SELECT `c`.`id`, `c`.`name`, `c`.`description`, `c`.`created`,
`c`.`owner`, `c`.`group`, `c`.`rights`, `c`.`defaultSearchField`,
`c`.`defaultSortField`, `c`.`advancedSearchTableFields`,
+ `c`.`defaultSortOrder`,
`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`
`rights` = '".$this->_DB->real_escape_string($data['rights'])."',
`defaultSearchField` = '".$this->_DB->real_escape_string($data['defaultSearchField'])."',
`defaultSortField` = '".$this->_DB->real_escape_string($data['defaultSortField'])."',
+ `defaultSortOrder` = '".$this->_DB->real_escape_string($data['defaultSortOrder'])."',
`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));
$queryStr = "SELECT `c`.`id`, `c`.`name`, `c`.`description`, `c`.`created`,
`c`.`owner`, `c`.`group`, `c`.`rights`, `c`.`defaultSearchField`,
`c`.`defaultSortField`,`c`.`advancedSearchTableFields`,
+ `c`.`defaultSortOrder`,
`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`
<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'=>'ASC')); ?>">Default</a></li>
+ <li><a href="index.php?<?php echo Summoner::createFromParameterLinkQuery($TemplateData['pagination']['currentGetParameters'],array('s'=>$TemplateData['defaultSortField'],'sd'=>$TemplateData['defaultSortOrder'])); ?>">Default</a></li>
<?php } else { ?>
<li><a href="index.php?<?php echo Summoner::createFromParameterLinkQuery($TemplateData['pagination']['currentGetParameters'],array('s'=>'','sd'=>'ASC')); ?>">Latest</a></li>
<?php } ?>
$_sort = Summoner::validate($_sort,'nospace') ? $_sort : false;
}
-$_sortDirection = false;
+$_sortDirection = '';
if(isset($_GET['sd']) && !empty($_GET['sd'])) {
$_sortDirection = trim($_GET['sd']);
$_sortDirection = Summoner::validate($_sortDirection,'nospace') ? $_sortDirection : false;
if(!empty($TemplateData['loadedCollection'])) {
$Mancubus->setCollection($Trite->param('id'));
- $TemplateData['defaultSortField'] = $defaultSortField = $Trite->param('defaultSortField');
+ $TemplateData['defaultSortField'] = $Trite->param('defaultSortField');
+ $TemplateData['defaultSortOrder'] = $Trite->param('defaultSortOrder');
$TemplateData['simpleSearchFields'] = $Trite->getSimpleSearchFields();
if(!empty($_queryOptions['sort'])) {
$TemplateData['simpleSearchFields'][$_queryOptions['sort']]['selected'] = true;
$_queryOptions['sort'] = $TemplateData['defaultSortField'];
}
}
+ if(!empty($TemplateData['defaultSortOrder'])) {
+ if(empty($_queryOptions['sortDirection'])) {
+ $_queryOptions['sortDirection'] = $TemplateData['defaultSortOrder'];
+ }
+ }
$Mancubus->setQueryOptions($_queryOptions);
</select>
</div>
</div>
+ <div class="uk-margin">
+ <label class="uk-form-label" for="defaultSortField">Default sort order</label>
+ <div class="uk-form-controls">
+ <select class="uk-select" id="defaultSortOrder" name="fdata[defaultSortOrder]">
+ <option value="ASC" <?php if(Summoner::ifsetValue($TemplateData['editData'], 'defaultSortOrder', 'ASC')) echo 'selected'; ?>>ASCENDING</option>
+ <option value="DESC" <?php if(Summoner::ifsetValue($TemplateData['editData'], 'defaultSortOrder', 'DESC')) echo 'selected'; ?>>DESCENDING</option>
+ </select>
+ </div>
+ </div>
<div class="uk-margin">
<label class="uk-form-label" for="advancedSearchTableFields">Table advanced search view</label>
<div class="uk-form-controls">
$_saveData['rights'] = Summoner::prepareRightsString($fdata['rights']);
$_saveData['defaultSearchField'] = $fdata['defaultSearchField'];
$_saveData['defaultSortField'] = $fdata['defaultSortField'];
+ $_saveData['defaultSortOrder'] = $fdata['defaultSortOrder'];
$_saveData['id'] = $_id;
$_saveData['tool'] = array();