Changeset 28709


Ignore:
Timestamp:
Jun 17, 2014, 1:11:44 PM (10 years ago)
Author:
plg
Message:

feature 3093: search form, ability to select the list of properties on which
the search terms applies.

feature 3094: minor redesign on search form.

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/functions_search.inc.php

    r28587 r28709  
    8686  if (isset($search['fields']['allwords']))
    8787  {
    88     $fields = array('file', 'name', 'comment', 'author');
     88    $fields = array('file', 'name', 'comment');
     89
     90    if (isset($search['fields']['allwords']['fields']) and count($search['fields']['allwords']['fields']) > 0)
     91    {
     92      $fields = array_intersect($fields, $search['fields']['allwords']['fields']);
     93    }
     94   
    8995    // in the OR mode, request bust be :
    9096    // ((field1 LIKE '%word1%' OR field2 LIKE '%word1%')
  • trunk/language/en_UK/common.lang.php

    r27882 r28709  
    420420$lang['Theme'] = 'Theme';
    421421$lang['No results for'] = 'No results for';
     422$lang['Apply on properties'] = 'Apply on properties';
     423$lang['Photo title'] = 'Photo title';
     424$lang['Photo description'] = 'Photo description';
    422425?>
  • trunk/language/fr_FR/common.lang.php

    r27901 r28709  
    420420$lang['Theme'] = 'Thème';
    421421$lang['No results for'] = 'Aucun résultat pour';
     422$lang['Apply on properties'] = 'Appliquer sur les propriétés';
     423$lang['Photo title'] = 'Titre de la photo';
     424$lang['Photo description'] = 'Description de la photo';
  • trunk/search.php

    r28708 r28709  
    4949  {
    5050    check_input_parameter('mode', $_POST, false, '/^(OR|AND)$/');
     51
     52    $fields = array_intersect($_POST['fields'], array('name', 'comment', 'file'));
    5153   
    5254    $drop_char_match = array(
     
    7072        ),
    7173      'mode' => $_POST['mode'],
     74      'fields' => $fields,
    7275      );
    7376  }
  • trunk/themes/default/template/search.tpl

    r28708 r28709  
    3232<form class="filter" method="post" name="search" action="{$F_SEARCH_ACTION}">
    3333<fieldset>
    34   <legend>{'Filter'|@translate}</legend>
    35   <label>{'Search for words'|@translate}
    36     <input type="text" name="search_allwords" size="35">
    37   </label>
    38   <ul>
    39     <li><label>
    40       <input type="radio" name="mode" value="AND" checked="checked">{'Search for all terms'|@translate}
    41     </label></li>
    42     <li><label>
    43       <input type="radio" name="mode" value="OR">{'Search for any term'|@translate}
    44     </label></li>
    45   </ul>
    46   <label>{'Search for Author'|@translate}
     34  <legend>{'Search for words'|@translate}</legend>
     35  <p>
     36    <input type="text" name="search_allwords">
     37    <br>
     38    <label><input type="radio" name="mode" value="AND" checked="checked">{'Search for all terms'|@translate}</label>
     39    <label><input type="radio" name="mode" value="OR">{'Search for any term'|@translate}</label>
     40  </p>
     41
     42  <p>
     43    <strong>{'Apply on properties'|translate}</strong><br>
     44    <label><input type="checkbox" name="fields[]" value="name" checked="checked">{'Photo title'|translate}</label>
     45    <label><input type="checkbox" name="fields[]" value="comment" checked="checked">{'Photo description'|translate}</label>
     46    <label><input type="checkbox" name="fields[]" value="file" checked="checked">{'File name'|translate}</label>
     47  </p>
     48
     49</fieldset>
     50
     51<fieldset>
     52  <legend>{'Search for Author'|@translate}</legend>
     53  <p>
    4754    <select id="authors" placeholder="{'Type in a search term'|translate}" name="authors[]" multiple style="width:500px;">
    4855{foreach from=$AUTHORS item=author}
     
    5057{/foreach}
    5158    </select>
    52   </label>
     59  </p>
    5360</fieldset>
    5461
     
    5663<fieldset>
    5764  <legend>{'Search tags'|@translate}</legend>
    58 
     65  <p>
    5966  <select id="tags" placeholder="{'Type in a search term'|translate}" name="tags[]" multiple style="width:500px;">
    6067{foreach from=$TAGS item=tag}
     
    6269{/foreach}
    6370  </select>
    64 
    6571  <label><span><input type="radio" name="tag_mode" value="AND" checked="checked"> {'All tags'|@translate}</span></label>
    6672  <label><span><input type="radio" name="tag_mode" value="OR"> {'Any tag'|@translate}</span></label>
     73  </p>
    6774</fieldset>
    6875{/if}
     
    121128<fieldset>
    122129  <legend>{'Search in albums'|@translate}</legend>
    123   <label>{'Albums'|@translate}
     130  <p>
    124131    <select class="categoryList" name="cat[]" multiple="multiple" size="15">
    125132      {html_options options=$category_options selected=$category_options_selected}
    126133    </select>
    127   </label>
    128   <ul>
    129     <li><label>{'Search in sub-albums'|@translate}</label></li>
    130     <li><label>
    131       <input type="radio" name="subcats-included" value="1" checked="checked">{'Yes'|@translate}
    132     </label></li>
    133     <li><label>
    134       <input type="radio" name="subcats-included" value="0">{'No'|@translate}
    135     </label></li>
    136   </ul>
     134    <br>
     135    <label><input type="checkbox" name="subcats-included" value="1" checked="checked">{'Search in sub-albums'|@translate}</label>
     136  </p>
    137137</fieldset>
    138138<p>
  • trunk/themes/default/theme.css

    r28707 r28709  
    510510}
    511511
    512 .filter UL,
    513 .filter LABEL {
     512.filter UL {
    514513        display: block;
    515514        float: left;
     
    523522}
    524523
     524.filter FIELDSET {
     525  padding-bottom:0;
     526}
     527
    525528.filter LI LABEL {
    526529        display: inline;
     
    528531}
    529532
     533.filter P {
     534  text-align:left;
     535  margin:0 0 15px 0;
     536  line-height:20px;
     537}
     538
     539.filter input[name="search_allwords"] {
     540  width:500px;
     541}
     542
     543.filter P input[type="checkbox"], .filter P input[type="radio"] {
     544  vertical-align:middle;
     545  margin-top:-4px;
     546}
     547
     548.filter input[type="submit"] {
     549  margin-left:1em;
     550}
     551
     552.filter P LABEL {
     553  margin-right:1em;
     554}
     555
    530556/*IE6 needs override because of > selector*/
    531557.filter LABEL>INPUT,
    532558.filter LABEL>SELECT {
    533         display: block;
     559        /* display: block; */
    534560        margin: 0.5em 0;
    535561}
Note: See TracChangeset for help on using the changeset viewer.