From 4f9a0544218341204bee98d41bcc097dc61f1799 Mon Sep 17 00:00:00 2001 From: vincent-peugnet Date: Mon, 10 Feb 2020 11:42:17 +0100 Subject: add case sensitivity option in dsb *deep search bar --- MANUAL.md | 11 +++++++++++ app/class/Controllerhome.php | 3 ++- app/class/Modelhome.php | 7 ++++++- app/view/templates/home.php | 2 ++ assets/css/home.css | 11 +++++++++++ 5 files changed, 32 insertions(+), 2 deletions(-) diff --git a/MANUAL.md b/MANUAL.md index 575b2da..b7facbb 100644 --- a/MANUAL.md +++ b/MANUAL.md @@ -117,12 +117,23 @@ In the home menu [super editors and above](#super-editor) can : - __Bookmarks :__ Save your [filtering options](#options) presets here. Common and personnal storages are possible. - __Display :__ Set columns to be shown (user based) and tag colors. + +##### Deep Search Bar + +The Deep Search bar help you to look for words or regular expressions in your pages. + +By default, searching only look in [title](#page-title), [description](#description) and [contents (markdown elements)](#markdown-elements), but the "other" checkbox will allow you to look up in [css](#css), [javascript](#javascript) and [BODY](#body) contents. + +Unlike the [filterings options](#options) below, searches can't be saved or used for [page lists](#page-list). + ##### Options The option panel contains multiples options for sorting and filtering your pages database. Just select the options you want and press "Fitler". Use the "Reset" button to come back to the default settings. W will keep the settings for the SESSION time. +This panel is also usefull to set up a [page list](#page-list) to include the same list of page you've filtered in any page. + ##### Pages The table is composed of [meta](#meta-infos) datas and actions links that are : diff --git a/app/class/Controllerhome.php b/app/class/Controllerhome.php index 2fa06fb..5a9110a 100644 --- a/app/class/Controllerhome.php +++ b/app/class/Controllerhome.php @@ -32,12 +32,13 @@ class Controllerhome extends Controllerpage $vars['colors'] = new Colors($this->opt->taglist()); if (!isset($_GET['search'])) { - $searchopt = ['title' => 1, 'description' => 1, 'content' => 1, 'other' => 0]; + $searchopt = ['title' => 1, 'description' => 1, 'content' => 1, 'other' => 0, 'casesensitive' => 0]; } else { $searchopt['title'] = $_GET['title'] ?? 0; $searchopt['description'] = $_GET['description'] ?? 0; $searchopt['content'] = $_GET['content'] ?? 0; $searchopt['other'] = $_GET['other'] ?? 0; + $searchopt['casesensitive'] = $_GET['case'] ?? 0; } $regex = $_GET['search'] ?? ''; diff --git a/app/class/Modelhome.php b/app/class/Modelhome.php index 541eb07..e3d60a3 100644 --- a/app/class/Modelhome.php +++ b/app/class/Modelhome.php @@ -96,7 +96,12 @@ class Modelhome extends Modelpage */ public function deepsearch(string $regex, array $options, array $pagelist) : array { - $regex = '/' . $regex . '/'; + if($options['casesensitive']) { + $case = ''; + } else { + $case = 'i'; + } + $regex = '/' . $regex . '/' . $case; $pageselected = []; foreach ($pagelist as $page) { $count = 0; diff --git a/app/view/templates/home.php b/app/view/templates/home.php index 404e96d..68cf965 100644 --- a/app/view/templates/home.php +++ b/app/view/templates/home.php @@ -30,6 +30,8 @@ > + > + diff --git a/assets/css/home.css b/assets/css/home.css index a68e3b0..4867c72 100644 --- a/assets/css/home.css +++ b/assets/css/home.css @@ -404,6 +404,15 @@ main.info code { padding: 0 4px; } +article#manual a { + text-decoration: none; + background-color: #7b97b959; +} + +article#manual a:hover { + background-color: #7b97b9; +} + main.info pre {width: fit-content;padding: 1%;background-color: hsla(213, 31%, 20%, 1);white-space: pre-wrap;margin: 1%;} @@ -617,3 +626,5 @@ footer { + + -- cgit v1.2.3