From 6f8caf22ba22395b0e038989bfdc2726cc4c2342 Mon Sep 17 00:00:00 2001 From: plegall Date: Tue, 17 Jun 2014 11:11:44 +0000 Subject: feature 3093: search form, ability to select the list of properties on which the search terms applies. feature 3094: minor redesign on search form. git-svn-id: http://piwigo.org/svn/trunk@28709 68402e56-0260-453c-a942-63ccdbb3a9ee --- include/functions_search.inc.php | 8 +++++- language/en_UK/common.lang.php | 3 +++ language/fr_FR/common.lang.php | 5 +++- search.php | 3 +++ themes/default/template/search.tpl | 54 +++++++++++++++++++------------------- themes/default/theme.css | 32 +++++++++++++++++++--- 6 files changed, 73 insertions(+), 32 deletions(-) diff --git a/include/functions_search.inc.php b/include/functions_search.inc.php index 928673b3b..bc74867a1 100644 --- a/include/functions_search.inc.php +++ b/include/functions_search.inc.php @@ -85,7 +85,13 @@ function get_sql_search_clause($search) if (isset($search['fields']['allwords'])) { - $fields = array('file', 'name', 'comment', 'author'); + $fields = array('file', 'name', 'comment'); + + if (isset($search['fields']['allwords']['fields']) and count($search['fields']['allwords']['fields']) > 0) + { + $fields = array_intersect($fields, $search['fields']['allwords']['fields']); + } + // in the OR mode, request bust be : // ((field1 LIKE '%word1%' OR field2 LIKE '%word1%') // OR (field1 LIKE '%word2%' OR field2 LIKE '%word2%')) diff --git a/language/en_UK/common.lang.php b/language/en_UK/common.lang.php index c9e448a73..024eeb7ec 100644 --- a/language/en_UK/common.lang.php +++ b/language/en_UK/common.lang.php @@ -419,4 +419,7 @@ $lang['Password confirmation is missing. Please confirm the chosen password.'] = $lang['%d photos per page'] = '%d photos per page'; $lang['Theme'] = 'Theme'; $lang['No results for'] = 'No results for'; +$lang['Apply on properties'] = 'Apply on properties'; +$lang['Photo title'] = 'Photo title'; +$lang['Photo description'] = 'Photo description'; ?> \ No newline at end of file diff --git a/language/fr_FR/common.lang.php b/language/fr_FR/common.lang.php index 208c50b83..4f2b48e35 100644 --- a/language/fr_FR/common.lang.php +++ b/language/fr_FR/common.lang.php @@ -418,4 +418,7 @@ $lang['Password is missing. Please enter the password.'] = "Le mot de passe manq $lang['Password confirmation is missing. Please confirm the chosen password.'] = "La confirmation du mot de passe manque. Veuillez confirmer le mot de passe choisi."; $lang['%d photos per page'] = '%d photos par page'; $lang['Theme'] = 'Thème'; -$lang['No results for'] = 'Aucun résultat pour'; \ No newline at end of file +$lang['No results for'] = 'Aucun résultat pour'; +$lang['Apply on properties'] = 'Appliquer sur les propriétés'; +$lang['Photo title'] = 'Titre de la photo'; +$lang['Photo description'] = 'Description de la photo'; diff --git a/search.php b/search.php index 247430fde..544eb9083 100644 --- a/search.php +++ b/search.php @@ -48,6 +48,8 @@ if (isset($_POST['submit'])) and !preg_match('/^\s*$/', $_POST['search_allwords'])) { check_input_parameter('mode', $_POST, false, '/^(OR|AND)$/'); + + $fields = array_intersect($_POST['fields'], array('name', 'comment', 'file')); $drop_char_match = array( '-','^','$',';','#','&','(',')','<','>','`','\'','"','|',',','@','_', @@ -69,6 +71,7 @@ if (isset($_POST['submit'])) ) ), 'mode' => $_POST['mode'], + 'fields' => $fields, ); } diff --git a/themes/default/template/search.tpl b/themes/default/template/search.tpl index 34b8f3625..21c61e8f7 100644 --- a/themes/default/template/search.tpl +++ b/themes/default/template/search.tpl @@ -31,39 +31,46 @@ jQuery(document).ready(function() {
- {'Filter'|@translate} - -
    -
  • -
  • -
-
+ +
+ {'Search for Author'|@translate} +

- +

{if isset($TAGS)}
{'Search tags'|@translate} - +

- +

{/if} @@ -120,20 +127,13 @@ jQuery(document).ready(function() {
{'Search in albums'|@translate} -

diff --git a/themes/default/theme.css b/themes/default/theme.css index bbf5e4091..ab298ecb3 100644 --- a/themes/default/theme.css +++ b/themes/default/theme.css @@ -509,8 +509,7 @@ FIELDSET { margin: 1em; } -.filter UL, -.filter LABEL { +.filter UL { display: block; float: left; margin-right: 1em; @@ -522,15 +521,42 @@ FIELDSET { margin-bottom: 0.5em; } +.filter FIELDSET { + padding-bottom:0; +} + .filter LI LABEL { display: inline; float: none; } +.filter P { + text-align:left; + margin:0 0 15px 0; + line-height:20px; +} + +.filter input[name="search_allwords"] { + width:500px; +} + +.filter P input[type="checkbox"], .filter P input[type="radio"] { + vertical-align:middle; + margin-top:-4px; +} + +.filter input[type="submit"] { + margin-left:1em; +} + +.filter P LABEL { + margin-right:1em; +} + /*IE6 needs override because of > selector*/ .filter LABEL>INPUT, .filter LABEL>SELECT { - display: block; + /* display: block; */ margin: 0.5em 0; } -- cgit v1.2.3