Changeset 1015


Ignore:
Timestamp:
01/27/06 23:40:51 (14 years ago)
Author:
plg
Message:

Search engine redesign, second part :

improvement: in category.php, an icon opening a popup display the list of
search rules.

modification: function get_search_array is responsible of search rules
retrieving from database. This function is called from get_sql_search_clause
and from search_rules.php

modification: ability to search multiple authors. Warning: this version of
search tool can't search author names including any blank space.

Location:
trunk
Files:
3 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/category.php

    r1014 r1015  
    166166  ) 
    167167); 
     168 
     169if (isset($page['cat']) and 'search' == $page['cat']) 
     170{ 
     171  $template->assign_block_vars( 
     172    'search_rules', 
     173    array( 
     174      'URL' => PHPWG_ROOT_PATH.'/search_rules.php?search_id='.$_GET['search'], 
     175      ) 
     176    ); 
     177} 
    168178//-------------------------------------------------------------- external links 
    169179if (count($conf['links']) > 0) 
  • trunk/include/functions.inc.php

    r1012 r1015  
    774774 
    775775/** 
    776  * returns the SQL clause from a search identifier 
    777  * 
    778  * Search rules are stored in search table as a serialized array. This array 
    779  * need to be transformed into an SQL clause to be used in queries. 
     776 * returns search rules stored into a serialized array in "search" 
     777 * table. Each search rules set is numericaly identified. 
    780778 * 
    781779 * @param int search_id 
    782  * @return string 
    783  */ 
    784 function get_sql_search_clause($search_id) 
     780 * @return array 
     781 */ 
     782function get_search_array($search_id) 
    785783{ 
    786784  if (!is_numeric($search_id)) 
     
    792790SELECT rules 
    793791  FROM '.SEARCH_TABLE.' 
    794   WHERE id = '.$_GET['search'].' 
     792  WHERE id = '.$search_id.' 
    795793;'; 
    796794  list($serialized_rules) = mysql_fetch_row(pwg_query($query)); 
    797795   
    798   $search = unserialize($serialized_rules); 
    799  
    800 //   echo '<pre>'; 
    801 //   print_r($search); 
    802 //   echo '</pre>'; 
    803  
     796  return unserialize($serialized_rules); 
     797} 
     798 
     799/** 
     800 * returns the SQL clause from a search identifier 
     801 * 
     802 * Search rules are stored in search table as a serialized array. This array 
     803 * need to be transformed into an SQL clause to be used in queries. 
     804 * 
     805 * @param int search_id 
     806 * @return string 
     807 */ 
     808function get_sql_search_clause($search_id) 
     809{ 
     810  $search = get_search_array($search_id); 
     811   
    804812  // SQL where clauses are stored in $clauses array during query 
    805813  // construction 
  • trunk/language/en_UK.iso-8859-1/common.lang.php

    r949 r1015  
    4242$lang['%d waiting elements'] = '%d waiting elements'; 
    4343$lang['About'] = 'About'; 
     44$lang['At least one listed rule must be satisfied.'] = 'At least one listed rule must be satisfied.'; 
    4445$lang['Author'] = 'Author'; 
    4546$lang['Average rate'] = 'Average rate'; 
     
    4849$lang['Close this window'] = 'Close this window'; 
    4950$lang['Confirm Password'] = 'Confirm Password'; 
     51$lang['Connection settings'] = 'Connection settings'; 
    5052$lang['Connection'] = 'Connection'; 
    51 $lang['Quick connect'] = 'Quick connect'; 
    52 $lang['Connection settings'] = 'Connection settings'; 
    5353$lang['Contact webmaster'] = 'Contact webmaster'; 
    5454$lang['Create a new account'] = 'Create a new account'; 
     
    5757$lang['Dimensions'] = 'Dimensions'; 
    5858$lang['Display'] = 'Display'; 
     59$lang['Each listed rule must be satisfied.'] = 'Each listed rule must be satisfied.'; 
    5960$lang['Email address is missing'] = 'Email address is missing'; 
    6061$lang['Email address'] = 'Email address'; 
     
    8687$lang['PhpWebGallery Help'] = 'PhpWebGallery Help'; 
    8788$lang['Profile'] = 'Profile'; 
     89$lang['Quick connect'] = 'Quick connect'; 
    8890$lang['RSS feed'] = 'RSS feed'; 
    8991$lang['Register'] = 'Register'; 
     
    9294$lang['Reset'] = 'Reset'; 
    9395$lang['Retrieve password'] = 'Retrieve password'; 
     96$lang['Search rules'] = 'Search rules'; 
    9497$lang['Search'] = 'Search'; 
    9598$lang['Send new password'] = 'Send new password'; 
     
    109112$lang['add_favorites_hint'] = 'Add this picture to your favorites'; 
    110113$lang['admin'] = 'Administration'; 
     114$lang['all'] = 'all'; 
    111115$lang['all_categories'] = 'all categories'; 
    112116$lang['already_rated'] = 'You\'ve already rated this item'; 
     117$lang['ascending'] = 'ascending'; 
     118$lang['author(s) : %s'] = 'author(s) : %s'; 
    113119$lang['auto_expand'] = 'Expand all categories'; 
     120$lang['became available after %s (%s)'] = 'became available after %s (%s)'; 
     121$lang['became available before %s (%s)'] = 'became available before %s (%s)'; 
     122$lang['became available between %s (%s) and %s (%s)'] = 'became available between %s (%s) and %s (%s)'; 
     123$lang['became available on %s'] = 'became available on %s'; 
    114124$lang['best_rated_cat'] = 'best rated'; 
    115125$lang['best_rated_cat_hint'] = 'displays best rated items'; 
     
    119129$lang['calendar_picture_hint'] = 'displays pictures added on '; 
    120130$lang['categories'] = 'Categories'; 
     131$lang['comment date'] = 'comment date'; 
    121132$lang['comment'] = 'Comment'; 
    122133$lang['comment_added'] = 'Your comment has been registered'; 
     
    129140$lang['comments_title'] = 'Comments from the users of the site'; 
    130141$lang['confirm_password_hint'] = 'You only have to confirm your new password if you wish to change it.'; 
     142$lang['created after %s (%s)'] = 'created after %s (%s)'; 
     143$lang['created before %s (%s)'] = 'created before %s (%s)'; 
     144$lang['created between %s (%s) and %s (%s)'] = 'created between %s (%s) and %s (%s)'; 
     145$lang['created on %s'] = 'created on %s'; 
    131146$lang['customize'] = 'Customize'; 
    132147$lang['customize_page_title'] = 'Your Gallery Customization '; 
     
    143158$lang['del_favorites_hint'] = 'Delete this picture from your favorites'; 
    144159$lang['delete'] = 'Delete'; 
     160$lang['descending'] = 'descending'; 
    145161$lang['download'] = 'download'; 
    146162$lang['download_hint'] = 'download this file'; 
     
    148164$lang['edit'] = 'edit'; 
    149165$lang['err_date'] = 'wrong date'; 
     166$lang['excluded'] = 'excluded'; 
    150167$lang['favorite_cat'] = 'My favorites'; 
    151168$lang['favorite_cat_hint'] = 'display my favorites pictures'; 
     
    169186$lang['identification'] = 'Identification'; 
    170187$lang['images_available'] = 'images in this category'; 
     188$lang['included'] = 'included'; 
    171189$lang['invalid_pwd'] = 'Invalid password!'; 
    172190$lang['language']='Language'; 
     
    211229$lang['password_hint'] = 'You only have to give your password if you wish to change your e-mail'; 
    212230$lang['periods_error'] = 'Recent period must be a positive integer value'; 
     231$lang['picture'] = 'picture'; 
    213232$lang['picture_high'] = 'Click on the picture to see it in high definition'; 
    214233$lang['picture_show_metadata'] = 'Show file metadata'; 
     
    259278$lang['search_subcats_included'] = 'Search in subcategroies'; 
    260279$lang['search_title'] = 'Search'; 
     280$lang['searched words : %s'] = 'searched words : %s'; 
    261281$lang['send_mail'] = 'Contact'; 
    262282$lang['set as category representative'] = 'set as category representative'; 
     
    300320$lang['w_month'] = 'Month'; 
    301321$lang['yes'] = 'Yes'; 
    302  
    303 $lang['descending'] = 'descending'; 
    304 $lang['all'] = 'all'; 
    305 $lang['ascending'] = 'ascending'; 
    306 $lang['comment date'] = 'comment date'; 
    307 $lang['picture'] = 'picture'; 
    308322?> 
  • trunk/language/fr_FR.iso-8859-1/common.lang.php

    r969 r1015  
    4141$lang['%d new users'] = '%d nouveaux utilisateurs'; 
    4242$lang['About'] = 'À propos'; 
     43$lang['At least one listed rule must be satisfied.'] = 'Au moins un des critères doit être satisfait.'; 
    4344$lang['Author'] = 'Auteur'; 
    4445$lang['Average rate'] = 'Note moyenne'; 
     
    4748$lang['Close this window'] = 'Fermer cette fenêtre'; 
    4849$lang['Confirm Password'] = 'Confirmer le mot de passe'; 
     50$lang['Connection settings'] = 'Paramètres de connexion'; 
    4951$lang['Connection'] = 'Connexion'; 
    50 $lang['Quick connect'] = 'Connexion rapide'; 
    51 $lang['Connection settings'] = 'Paramètres de connexion'; 
    5252$lang['Contact webmaster'] = 'Contacter le webmestre'; 
    5353$lang['Create a new account'] = 'Créer un nouveau compte'; 
     
    5656$lang['Dimensions'] = 'Dimensions'; 
    5757$lang['Display'] = 'Affichage'; 
     58$lang['Each listed rule must be satisfied.'] = 'Chaque critère doit être satisfait'; 
    5859$lang['Email address is missing'] = 'L\'adresse e-mail manque'; 
    5960$lang['Email address'] = 'Adresse e-mail'; 
     
    8586$lang['PhpWebGallery Help'] = 'Aide de PhpWebGallery'; 
    8687$lang['Profile'] = 'Profil'; 
     88$lang['Quick connect'] = 'Connexion rapide'; 
    8789$lang['RSS feed'] = 'flux RSS'; 
    8890$lang['Register'] = 'S\'enregistrer'; 
     
    9193$lang['Reset'] = 'Annuler'; 
    9294$lang['Retrieve password'] = 'Récupérer un mot de passe'; 
     95$lang['Search rules'] = 'Critères de recherche'; 
    9396$lang['Search'] = 'Rechercher'; 
    9497$lang['Send new password'] = 'Envoyer le nouveau mot de passe'; 
     
    112115$lang['already_rated'] = 'Vous avez déjà voté pour cette image'; 
    113116$lang['ascending'] = 'croissant'; 
     117$lang['author(s) : %s'] = 'auteur(s) : %s'; 
    114118$lang['auto_expand'] = 'Développer toutes les catégories'; 
     119$lang['became available after %s (%s)'] = 'mis à disposition après le %s (%s)'; 
     120$lang['became available before %s (%s)'] = 'mis à disposition avant le %s (%s)'; 
     121$lang['became available between %s (%s) and %s (%s)'] = 'mis à disposition entre le %s (%s) et le %s (%s)'; 
     122$lang['became available on %s'] = 'mis à disposition le %s'; 
    115123$lang['best_rated_cat'] = 'Mieux notées'; 
    116124$lang['best_rated_cat_hint'] = 'affiche les images les mieux notées'; 
     
    131139$lang['comments_title'] = 'Commentaires des utilisateurs'; 
    132140$lang['confirm_password_hint'] = 'Vous n\'avez à confirmer votre mot de passe que si vous désirez en changer.'; 
     141$lang['created after %s (%s)'] = 'créée après le %s (%s)'; 
     142$lang['created before %s (%s)'] = 'créée avant le %s (%s)'; 
     143$lang['created between %s (%s) and %s (%s)'] = 'créée entre le %s (%s) et le %s (%s)'; 
     144$lang['created on %s'] = 'créée le %s'; 
    133145$lang['customize'] = 'Personnaliser'; 
    134146$lang['customize_page_title'] = 'Personnalisation de votre affichage '; 
     
    151163$lang['edit'] = 'éditer'; 
    152164$lang['err_date'] = 'date erronée'; 
     165$lang['excluded'] = 'exclus'; 
    153166$lang['favorite_cat'] = 'Mes favorites'; 
    154167$lang['favorite_cat_hint'] = 'afficher mes images favorites'; 
     
    172185$lang['identification'] = 'Identification'; 
    173186$lang['images_available'] = 'images dans cette catégorie'; 
     187$lang['included'] = 'inclus'; 
    174188$lang['invalid_pwd'] = 'Mot de passe invalide !'; 
    175189$lang['language'] = 'Langue'; 
     
    263277$lang['search_subcats_included'] = 'Rechercher dans les sous-catégories'; 
    264278$lang['search_title'] = 'Recherche'; 
     279$lang['searched words : %s'] = 'mots recherchés : %s'; 
    265280$lang['send_mail'] = 'Contacter'; 
    266281$lang['set as category representative'] = 'élire comme représentant de cette catégorie'; 
  • trunk/search.php

    r1009 r1015  
    6565  { 
    6666    $search['fields']['author'] = array( 
    67       'words' => array($_POST['search_author']), 
     67      'words' => preg_split( 
     68        '/\s+/', 
     69        $_POST['search_author'] 
     70        ), 
     71      'mode' => 'OR', 
    6872      ); 
    6973  } 
  • trunk/template/yoga/category.tpl

    r972 r1015  
    108108    <ul class="categoryActions"> 
    109109      <li>&nbsp;</li> 
     110       
    110111      <!-- BEGIN caddie --> 
    111112      <li><a href="{caddie.URL}" title="{lang:add to caddie}"><img src="{themeconf:icon_dir}/caddie_add.png" class="button" alt="{lang:caddie}"/></a></li> 
    112113      <!-- END caddie --> 
     114       
    113115      <!-- BEGIN edit --> 
    114116      <li><a href="{edit.URL}" title="{lang:edit category informations}"><img src="{themeconf:icon_dir}/category_edit.png" class="button" alt="{lang:edit}"/></a></li> 
    115117      <!-- END edit --> 
     118 
     119      <!-- BEGIN search_rules --> 
     120      <li><a href="{search_rules.URL}" style="border:none;" onclick="popuphelp(this.href); return false;" title="{lang:Search rules}"><img src="{themeconf:icon_dir}/search_rules.png" class="button" alt="(?)"></a></li> 
     121      <!-- END search_rules --> 
     122 
    116123    </ul> 
    117     <h2>{TITLE}</h2> 
    118   </div> 
     124     
     125  <h2>{TITLE}</h2> 
     126     
     127  </div> <!-- content --> 
     128     
    119129<!-- BEGIN calendar --> 
    120130<div class="navigationBar">{calendar.YEARS_NAV_BAR}</div> 
Note: See TracChangeset for help on using the changeset viewer.