From 2c109654aac3eda8b98afb8b69b05f921091744d Mon Sep 17 00:00:00 2001 From: gweltas Date: Thu, 25 Nov 2004 14:12:33 +0000 Subject: New ergonomic form for search queries. git-svn-id: http://piwigo.org/svn/trunk@621 68402e56-0260-453c-a942-63ccdbb3a9ee --- include/category_default.inc.php | 2 +- include/functions_category.inc.php | 84 +++--- language/en_UK.iso-8859-1/common.lang.php | 47 ++-- language/fr_FR.iso-8859-1/common.lang.php | 50 ++-- search.php | 411 ++++++++---------------------- template/default/default.css | 47 +--- template/default/search.tpl | 186 +++++++------- 7 files changed, 288 insertions(+), 539 deletions(-) diff --git a/include/category_default.inc.php b/include/category_default.inc.php index 2e89be05b..943bc7b5e 100644 --- a/include/category_default.inc.php +++ b/include/category_default.inc.php @@ -46,7 +46,7 @@ SELECT DISTINCT(id),path,file,date_available,category_id '.$conf['order_by'].' LIMIT '.$page['start'].','.$page['nb_image_page'].' ;'; -// echo '
'.$query.'
'; +//echo '
'.$query.'
'; $result = pwg_query($query); // template thumbnail initialization diff --git a/include/functions_category.inc.php b/include/functions_category.inc.php index 3561caff8..f92820aa8 100644 --- a/include/functions_category.inc.php +++ b/include/functions_category.inc.php @@ -165,21 +165,9 @@ function count_user_total_images() $query.= ' WHERE id NOT IN ('.$user['forbidden_categories'].')'; $query.= ';'; -// $query = ' -// SELECT COUNT(DISTINCT(image_id)) as total -// FROM '.PREFIX_TABLE.'image_category'; -// if (count($user['restrictions']) > 0) -// { -// $query.= ' -// WHERE category_id NOT IN ('.$user['forbidden_categories'].')'; -// } -// $query = ' -// ;'; - $row = mysql_fetch_array( pwg_query( $query ) ); if ( !isset( $row['total'] ) ) $row['total'] = 0; - return $row['total']; } @@ -344,7 +332,7 @@ function initialize_category( $calling_page = 'category' ) // By default, it is the same as the $user['nb_image_page'] $page['nb_image_page'] = $user['nb_image_page']; // $url is used to create the navigation bar - $url = './category.php?cat='.$page['cat']; + $url = PHPWG_ROOT_PATH.'category.php?cat='.$page['cat']; if ( isset($page['expand']) ) $url.= '&expand='.$page['expand']; // simple category if ( is_numeric( $page['cat'] ) ) @@ -427,25 +415,30 @@ function initialize_category( $calling_page = 'category' ) // SQL where clauses are stored in $clauses array during query // construction - $clauses = array(); - - $textfields = array('file', 'name', 'comment', 'keywords', 'author'); - foreach ($textfields as $textfield) - { - if (isset($search['fields'][$textfield])) + $clauses = $temp_clauses = array(); + if (isset($search['fields']['keywords'])) + { + $textfields = array('file', 'name', 'comment', 'keywords', 'author'); + foreach ($textfields as $textfield) { $local_clauses = array(); - foreach ($search['fields'][$textfield]['words'] as $word) + foreach ($search['fields']['keywords']['words'] as $word) { array_push($local_clauses, $textfield." LIKE '%".$word."%'"); } // adds brackets around where clauses array_walk($local_clauses,create_function('&$s','$s="(".$s.")";')); - array_push($clauses, - implode(' '.$search['fields'][$textfield]['mode'].' ', + array_push($temp_clauses, + implode(' '.$search['fields']['keywords']['mode'].' ', $local_clauses)); } + array_push($clauses, implode(' OR ', $temp_clauses)); } + + if (isset($search['fields']['author'])) + { + array_push($clauses, "author LIKE '%".$search['fields']['author']['words'][0]."%'"); + } $datefields = array('date_available', 'date_creation'); foreach ($datefields as $datefield) @@ -453,41 +446,30 @@ function initialize_category( $calling_page = 'category' ) $key = $datefield; if (isset($search['fields'][$key])) { - $local_clause = $datefield." = '"; + $local_clause = $datefield." "; + if (isset($search['fields'][$key]['mode'])) + { + $local_clause .=">"; + } + $local_clause .="= '"; $local_clause.= str_replace('.', '-', $search['fields'][$key]['words'][0]); $local_clause.= "'"; array_push($clauses, $local_clause); - } - - foreach (array('after','before') as $suffix) + + if (isset($search['fields'][$key]['mode'])) { - $key = $datefield.'-'.$suffix; - if (isset($search['fields'][$key])) - { - $local_clause = $datefield; - if ($suffix == 'after') - { - $local_clause.= ' >'; - } - else - { - $local_clause.= ' <'; - } - if (isset($search['fields'][$key]['mode']) - and $search['fields'][$key]['mode'] == 'inc') - { - $local_clause.= '='; - } - $local_clause.= " '"; - $local_clause.= str_replace('.', '-', - $search['fields'][$key]['words'][0]); - $local_clause.= "'"; - array_push($clauses, $local_clause); - } + $search_tokens = explode('.', $search['fields'][$key]['words'][0]); + $start_time = mktime(0, 0, 0, $search_tokens[1], $search_tokens[2],$search_tokens[0]); + $search_duration = intval($search['fields'][$key]['mode']) * 86400; + $end_time = $start_time + $search_duration; + $end_sql_date = date('Y-m-d',$end_time); + $local_clause = $datefield." <= '".$end_sql_date."'"; + array_push($clauses, $local_clause); } + } } - + if (isset($search['fields']['cat'])) { if ($search['fields']['cat']['mode'] == 'sub_inc') @@ -529,7 +511,7 @@ SELECT DISTINCT(id) AS id // adds brackets around where clauses array_walk($clauses, create_function('&$s', '$s = "(".$s.")";')); - $page['where'] = 'WHERE '.implode(' '.$search['mode'].' ', $clauses); + $page['where'] = 'WHERE '.implode(' AND ', $clauses); if ( isset( $forbidden ) ) $page['where'].= ' AND '.$forbidden; $query = ' diff --git a/language/en_UK.iso-8859-1/common.lang.php b/language/en_UK.iso-8859-1/common.lang.php index 693906548..315be34be 100644 --- a/language/en_UK.iso-8859-1/common.lang.php +++ b/language/en_UK.iso-8859-1/common.lang.php @@ -119,6 +119,7 @@ $lang['day'][6] = 'Saturday'; $lang['w_month'] = 'Month'; $lang['w_day'] = 'Day'; $lang['days'] = 'days'; +$lang['today']='Today'; // Customization $lang['customize_page_title'] = 'Customization'; @@ -139,28 +140,29 @@ $lang['create_cookie'] = 'Create a cookie'; // search $lang['search_title'] = 'Search'; -$lang['search_wrong_date'] = ' : this date is not valid'; -$lang['search_wrong_date_order'] = 'the period end must be after the period start'; -$lang['search_incoherent_date_search'] = 'when choosing to match all the clauses, you can\'t search "date is" and "date is after" or "date is before"'; -$lang['search_or_clauses'] = 'at least one search clause'; -$lang['search_and_clauses'] = 'all search clauses'; -$lang['search_subcats_included'] = 'include sub-categories'; -$lang['search_date_included'] = 'included'; -$lang['search_date_is'] = 'is'; -$lang['search_date_is_after'] = 'is after'; -$lang['search_date_is_before'] = 'is before'; -$lang['search_file'] = 'file'; -$lang['search_name'] = 'name'; -$lang['search_comment'] = 'comment'; -$lang['search_keywords'] = 'keywords'; -$lang['search_author'] = 'author'; -$lang['search_date_available'] = 'availability date'; -$lang['search_date_creation'] = 'creation date'; -$lang['search_one_clause_at_least'] = 'search at least on one search clause'; -$lang['search_mode_or'] = 'at least one word'; -$lang['search_mode_and'] = 'all the words'; -$lang['search_comments'] = 'separate different words with spaces'; -$lang['invalid_search'] = 'search must be done on 3 caracters or more'; +$lang['search_options'] = 'Search Options'; +$lang['search_keywords'] = 'Search for Keywords'; +$lang['search_keywords_hint'] = 'Use + for words which must be found, - for words which must not be found and | for words which may or may not be found. Use * as a wildcard for partial matches'; +$lang['search_mode_or'] = 'Search for any terms'; +$lang['search_mode_and'] = 'Search for all terms '; +$lang['search_author'] = 'Search for Author'; +$lang['search_categories'] = 'Search in Categories'; +$lang['search_subcats_included'] = 'Search in subcategroies'; +$lang['search_categories_hint'] = 'Select the category or categories you wish to search in. For speed all subcategories can be searched by selecting the parent and setting enable search subcategories below.'; +$lang['search_explain'] = 'Use * as a wildcard for partial matches'; +$lang['search_date'] = 'Search by Date'; +$lang['search_date_hint'] = 'Select a date and a duration for your query. The date is inclusive.'; +$lang['search_date_from'] = 'From'; +$lang['search_duration'] = 'During'; +$lang['search_date_type'] = 'Kind of date'; +$lang['search_date_available'] = 'Availability'; +$lang['search_date_creation'] = 'Creation'; +$lang['search_sort'] = 'Sort results by'; +$lang['search_ascending'] = 'Ascending'; +$lang['search_descending'] = 'Descending'; +$lang['search_one_clause_at_least'] = 'Empty query. No criteria has been entered.'; +$lang['search_result'] = 'Search results'; + $lang['Search_author_explain'] = 'Use * as a wildcard for partial matches'; $lang['Look_up_user'] = 'Seek user'; $lang['Find_username'] = 'Find a username'; @@ -195,7 +197,6 @@ $lang['total'] = 'images'; $lang['upload_picture'] = 'Upload a picture'; $lang['generation_time'] = 'Page generated in'; $lang['favorites'] = 'Favorites'; -$lang['search_result'] = 'Search results'; $lang['about_page_title'] = 'About PhpWebGallery'; $lang['about_title'] = 'About...'; $lang['about_message'] = '
Information about PhpWebGallery
diff --git a/language/fr_FR.iso-8859-1/common.lang.php b/language/fr_FR.iso-8859-1/common.lang.php index c24aba279..715abe53c 100644 --- a/language/fr_FR.iso-8859-1/common.lang.php +++ b/language/fr_FR.iso-8859-1/common.lang.php @@ -117,7 +117,9 @@ $lang['day'][4] = 'Jeudi'; $lang['day'][5] = 'Vendredi'; $lang['day'][6] = 'Samedi'; $lang['w_month']='Mois'; -$lang['w_day']='Jour'; +$lang['w_day']='Jour';; +$lang['days']='Jours'; +$lang['today']='Aujourd\'hui'; // Customization @@ -138,30 +140,31 @@ $lang['maxwidth_error'] = 'La largeur maximum des images doit $lang['maxheight_error'] = 'La hauteur maximum des images doit être un entier supérieur à 50'; // search -$lang['search_wrong_date'] = ' : date non valide'; -$lang['search_wrong_date_order'] = 'La date de fin doit être postérieure à la date de début'; -$lang['search_incoherent_date_search'] = 'Vous devez choisir une date unique ou une période.'; -$lang['search_or_clauses'] = 'Au moins une condition vérifiée'; -$lang['search_and_clauses'] = 'Toutes les conditions vérifiées'; -$lang['search_subcats_included'] = 'include sub-categories'; -$lang['search_date_included'] = 'included'; -$lang['search_date_is'] = 'est'; -$lang['search_date_is_after'] = 'après'; -$lang['search_date_is_before'] = 'avant'; -$lang['search_file'] = 'file'; -$lang['search_name'] = 'name'; -$lang['search_comment'] = 'comment'; -$lang['search_keywords'] = 'keywords'; -$lang['search_author'] = 'author'; -$lang['search_date_available'] = 'availability date'; -$lang['search_date_creation'] = 'creation date'; -$lang['search_one_clause_at_least'] = 'search at least on one search clause'; +$lang['search_title'] = 'Rechercher'; +$lang['search_options'] = 'Options de recherche'; +$lang['search_keywords'] = 'Recherche par mots-clés'; +$lang['search_keywords_hint'] = 'Vous pouvez utiliser AND pour déterminer les mots qui doivent être présents dans les résultats, OR pour déterminer les mots qui peuvent être présents dans les résultats et NOT pour déterminer les mots qui ne devraient pas être présents dans les résultats. Utilisez * comme un joker pour des recherches partielles'; +$lang['search_mode_or'] = 'Rechercher n\'importe quel de ces termes'; +$lang['search_mode_and'] = 'Rechercher tous les termes'; +$lang['search_author'] = 'Recherche par auteur'; +$lang['search_categories'] = 'Recherche dans les catégories'; +$lang['search_subcats_included'] = 'Rechercher dans les sous-catégories'; +$lang['search_categories_hint'] = 'Sélectionnez le ou les catégorie(s) pour lesquelles vous souhaitez faire votre rechercher.'; +$lang['search_explain'] = 'Utilisez * comme un joker pour des recherches partielles'; +$lang['search_date'] = 'Rechercher par date'; +$lang['search_date_hint'] = 'Sélectionnez une date de début et une période pour vos recherches'; +$lang['search_date_from'] = 'A partir du'; +$lang['search_duration'] = 'Sur une période de'; +$lang['search_date_type'] = 'Type de date'; +$lang['search_date_available'] = 'Mise à disposition'; +$lang['search_date_creation'] = 'Création'; +$lang['search_sort'] = 'Trier par'; +$lang['search_ascending'] = 'Croissant'; +$lang['search_descending'] = 'Décroissant'; +$lang['search_one_clause_at_least'] = 'Recherche vide. Aucun critère n\'a été renseigné.'; $lang['search_result'] = 'Résultats de la recherche'; $lang['invalid_search'] = 'Les mots recherchés doivent comporter plus de 3 caractères et ne doivent pas inclure de caractères de ponctuation'; -$lang['search_mode_or'] = 'au moins un mot'; -$lang['search_mode_and'] = 'tous les mots'; -$lang['search_comments'] = 'séparer les différents mots avec un espace'; -$lang['search_title'] = 'Recherche'; + $lang['search_field_search'] = 'Rechercher'; $lang['Search_author_explain'] = 'Utilisez * comme un joker pour des recherches partielles'; $lang['Look_up_user'] = 'Rechercher l\'utilisateur'; @@ -190,7 +193,6 @@ $lang['previous_page'] = 'Pr $lang['next_page'] = 'Suivante'; $lang['nb_image_category'] = 'nombre d\'images dans la catégorie'; $lang['recent_image'] = 'Image datant de moins de'; -$lang['days'] = 'jours'; $lang['send_mail'] = 'Contacter l\'adminstrateur'; $lang['title_send_mail'] = '[phpwebgallery] une remarque sur ton site'; $lang['sub-cat'] = 'sous-catégories'; diff --git a/search.php b/search.php index e38255308..408495ec9 100644 --- a/search.php +++ b/search.php @@ -25,178 +25,73 @@ // | USA. | // +-----------------------------------------------------------------------+ -//------------------------------------------------------------------- functions -// date_display displays 3 select input fields. The first one is the -// day of the month, from 0 to 31. The second is the month of the year, -// from 01 to 12. The last one is the year. The years displayed are the -// ones given by get_available_years (see function description in -// ./include/functions.inc.php). -function display_date($fieldname, $datefield) -{ - global $template; - - // years - for ($i = 1990; $i < 2006; $i++) - { - $selected = ''; - $key = $datefield.':year'; - if (isset($_POST[$key]) and $i == $_POST[$key]) - { - $selected = ' selected="selected"'; - } - - $template->assign_block_vars( - $fieldname.'year_option', - array('OPTION'=>$i, - 'SELECTED'=>$selected - )); - } - // months of year - for ($i = 1; $i <= 12; $i++) - { - $selected = ''; - $key = $datefield.':month'; - if (isset($_POST[$key]) and $i == $_POST[$key]) - { - $selected = ' selected="selected"'; - } - - $template->assign_block_vars( - $fieldname.'month_option', - array('OPTION'=>sprintf('%02s', $i), - 'SELECTED'=>$selected - )); - } - // days of the month - for ($i = 1; $i <= 31; $i++) - { - $selected = ''; - $key = $datefield.':day'; - if (isset($_POST[$key]) and $i == $_POST[$key]) - { - $selected = ' selected="selected"'; - } - - $template->assign_block_vars( - $fieldname.'day_option', - array('OPTION'=>sprintf('%02s', $i), - 'SELECTED'=>$selected - )); - } -} - -function display_3dates($fieldname) -{ - display_date('datefield.', $fieldname); - display_date('datefield.after_', $fieldname.'-after'); - display_date('datefield.before_', $fieldname.'-before'); -} //--------------------------------------------------------------------- include define('PHPWG_ROOT_PATH','./'); include_once( PHPWG_ROOT_PATH.'include/common.inc.php' ); //-------------------------------------------------- access authorization check check_login_authorization(); -//----------------------------------------------------------------- form fields -$textfields = array('file', 'name', 'comment', 'keywords', 'author'); -$datefields = array('date_available', 'date_creation'); //------------------------------------------------------------------ form check $errors = array(); $search = array(); -$search['fields'] = array(); if (isset($_POST['submit'])) { - $search['mode'] = $_POST['mode']; - - foreach ($textfields as $textfield) - { - if (isset($_POST[$textfield.'-content']) - and !preg_match('/^\s*$/', $_POST[$textfield.'-content'])) - { - $local_search = array(); - $words = preg_split('/\s+/', $_POST[$textfield.'-content']); - foreach ($words as $i => $word) - { - if (strlen($word) > 2 and !preg_match('/[,;:\']/', $word)) - { - array_push($local_search, $word); - } - else - { - array_push($errors, $lang['invalid_search']); - } - } - $local_search = array_unique($local_search); - $search['fields'][$textfield] = array(); - $search['fields'][$textfield]['words'] = $local_search; - if (count($local_search) > 1) - { - $search['fields'][$textfield]['mode'] = $_POST[$textfield.'-mode']; - } - } + if ($_POST['search_keywords'] && + !preg_match('/^\s*$/', $_POST['search_keywords'])) + { + $local_search = array(); + $search_keywords = $_POST['search_keywords']; + $drop_char_match = array('-', '^', '$', ';', '#', '&', '(', ')', '<', '>', + '`', '\'', '"', '|', ',', '@', '_', '?', '%', '~', '.', '[', ']', '{', '}', + ':', '\\', '/', '=', '\'', '!', '*'); + $drop_char_replace = array(' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', + '', '', ' ', ' ', ' ', ' ', '', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' + , ' ', '' , ' ', ' ', ' ', ' ', ' '); + $search_keywords = str_replace($drop_char_match, $drop_char_replace, $search_keywords); + + // Split words + $words = preg_split('#\s+#', $search_keywords); + $words = array_unique($words); + $search['fields']['keywords'] = array(); + $search['fields']['keywords']['words'] =$words; + $search['fields']['keywords']['mode']= $_POST['mode']; } - foreach ($datefields as $datefield) + + if ($_POST['search_author']) { - $suffixes = array('','-after','-before'); - foreach ($suffixes as $suffix) - { - $field = $datefield.$suffix; - if (isset($_POST[$field.'-check'])) - { - $year = $_POST[$field.':year']; - $month = $_POST[$field.':month']; - $day = $_POST[$field.':day']; - $date = $year.'.'.$month.'.'.$day; - if (!checkdate($month, $day, $year)) - { - array_push($errors, $date.$lang['search_wrong_date']); - } - $search['fields'][$field] = array(); - $search['fields'][$field]['words'] = array($date); - if ($suffix == '-after' or $suffix == '-before') - { - if (isset($_POST[$field.'-included'])) - { - $search['fields'][$field]['mode'] = 'inc'; - } - } - } - } - if ($search['mode'] == 'AND') - { - // before date must be superior to after date - if (isset($search['fields'][$datefield.'-before']) - and isset($search['fields'][$datefield.'-after'])) - { - $after = $search['fields'][$datefield.'-after']['words'][0]; - $before = $search['fields'][$datefield.'-before']['words'][0]; - if ($after >= $before) - { - array_push($errors, $lang['search_wrong_date_order']); - } - } - // having "search is" and ("search is after" or "search is before") is - // not coherent - if (isset($search['fields'][$datefield]) - and (isset($search['fields'][$datefield.'-before']) - or isset($search['fields'][$datefield.'-after']))) - { - array_push($errors, $lang['search_incoherent_date_search']); - } - } + $search['fields']['author'] = array(); + $search['fields']['author']['words'] = array($_POST['search_author']); } - if (isset($_POST['categories-check'])) + + if (isset($_POST['cat'])) { - $field = 'cat'; - $search['fields'][$field] = array(); - $search['fields'][$field]['words'] = $_POST['cat']; + $search['fields']['cat'] = array(); + $search['fields']['cat']['words'] = $_POST['cat']; if (isset($_POST['subcats-included'])) { - $search['fields'][$field]['mode'] = 'sub_inc'; + $search['fields']['cat']['mode'] = 'sub_inc'; } } + + if (!empty($_POST['start_year'])) + { + $type_date = $_POST['date_type']; + + // start event + $date = $_POST['start_year'].'.'.$_POST['start_month'].'.'.$_POST['start_day']; + $search['fields'][$type_date]['words'] = array($date); + + // duration + $search_duration = 0; + if ( !empty($date) && !empty( $_POST['duration_day']) ) + { + $search['fields'][$type_date]['mode'] = $_POST['duration_day']; + } + } // search string (for URL) creation $search_string = ''; $tokens = array(); + if (!empty($search)) + { foreach (array_keys($search['fields']) as $field) { $token = $field.':'; @@ -210,10 +105,10 @@ if (isset($_POST['submit'])) $search_string.= implode(';', $tokens); if (count($tokens) > 1) { - $search_string.= '|'.$search['mode']; + $search_string.= '|AND'; } - - if (count($tokens) == 0) + } + else { array_push($errors, $lang['search_one_clause_at_least']); } @@ -225,7 +120,36 @@ if (isset($_POST['submit']) and count($errors) == 0) $url = add_session_id($url, true); redirect($url); } + //----------------------------------------------------- template initialization +// day list +$start_day = ''; + +// month list +$start_month = ''; + +// year list +$start_year = ''; + + // // Start output of page // @@ -234,109 +158,47 @@ include(PHPWG_ROOT_PATH.'include/page_header.php'); $template->set_filenames( array('search'=>'search.tpl') ); $template->assign_vars(array( - 'L_TITLE' => $lang['search_title'], - 'L_SEARCH_COMMENTS' => $lang['search_comments'], + 'L_SEARCH_TITLE' => $lang['search_title'], + 'L_SEARCH_OPTIONS' => $lang['search_options'], 'L_RETURN' => $lang['home'], 'L_SUBMIT' => $lang['submit'], - 'L_SEARCH_OR'=>$lang['search_mode_or'], - 'L_SEARCH_AND'=>$lang['search_mode_and'], - 'L_SEARCH_OR_CLAUSES'=>$lang['search_or_clauses'], - 'L_SEARCH_AND_CLAUSES'=>$lang['search_and_clauses'], - 'L_SEARCH_CATEGORIES'=>$lang['categories'], - 'L_SEARCH_SUBCATS_INCLUDED'=>$lang['search_subcats_included'], - 'L_SEARCH_DATE_INCLUDED'=> $lang['search_date_included'], - 'L_SEARCH_DATE_IS'=>$lang['search_date_is'], - 'L_SEARCH_DATE_IS_AFTER'=>$lang['search_date_is_after'], - 'L_SEARCH_DATE_IS_BEFORE'=>$lang['search_date_is_before'], + 'L_RESET' => $lang['reset'], + 'L_SEARCH_KEYWORDS'=>$lang['search_keywords'], + 'L_SEARCH_KEYWORDS_HINT'=>$lang['search_keywords_hint'], + 'L_SEARCH_ANY_TERMS'=>$lang['search_mode_or'], + 'L_SEARCH_ALL_TERMS'=>$lang['search_mode_and'], + 'L_SEARCH_AUTHOR'=>$lang['search_author'], + 'L_SEARCH_AUTHOR_HINT'=>$lang['search_explain'], + 'L_SEARCH_CATEGORIES'=>$lang['search_categories'], + 'L_SEARCH_CATEGORIES_HINT'=>$lang['search_categories_hint'], + 'L_SEARCH_SUBFORUMS'=>$lang['search_subcats_included'], + 'L_YES' => $lang['yes'], + 'L_NO' => $lang['no'], + 'L_SEARCH_DATE' => $lang['search_date'], + 'L_SEARCH_DATE_HINT' => $lang['search_date_hint'], + 'L_TODAY' => $lang['today'], + 'L_SEARCH_DATE_FROM'=>$lang['search_date_from'], + 'L_SEARCH_DURATION'=>$lang['search_duration'], + 'L_DAYS'=>$lang['days'], + 'L_MONTH'=>$lang['w_month'], + 'L_SEARCH_DATE_TYPE'=>$lang['search_date_type'], + 'L_SEARCH_CREATION'=>$lang['search_date_creation'], + 'L_SEARCH_AVAILABILITY'=>$lang['search_date_available'], + 'L_RESULT_SORT'=>$lang['search_sort'], + 'L_SORT_ASCENDING'=>$lang['search_ascending'], + 'L_SORT_DESCENDING'=>$lang['search_descending'], - 'F_ACTION' => add_session_id( 'search.php' ), - + 'TODAY_DAY' => date('d', time()), + 'TODAY_MONTH' => date('m', time()), + 'TODAY_YEAR' => date('Y', time()), + 'S_CALENDAR_YEAR' => $start_year, + 'S_CALENDAR_MONTH' => $start_month, + 'S_CALENDAR_DAY' => $start_day, + 'S_SEARCH_ACTION' => add_session_id( 'search.php' ), 'U_HOME' => add_session_id( 'category.php' ) ) ); -//------------------------------------------------------------ text fields form -foreach ($textfields as $textfield) -{ - if (isset($_POST[$textfield.'-mode'])) - { - if ($_POST[$textfield.'-mode'] == 'AND') - { - $and_checked = 'checked="checked"'; - $or_checked = ''; - } - else - { - $or_checked = 'checked="checked"'; - $and_checked = ''; - } - } - else - { - $or_checked = 'checked="checked"'; - $and_checked = ''; - } - - $value = ''; - if (isset($_POST[$textfield.'-content'])) - { - $value = $_POST[$textfield.'-content']; - } - - $template->assign_block_vars( - 'textfield', - array('NAME'=>$lang['search_'.$textfield], - 'L_NAME'=>$textfield, - 'VALUE'=>$value, - 'OR_CHECKED'=>$or_checked, - 'AND_CHECKED'=>$and_checked - )); -} -//------------------------------------------------------------- date field form -foreach ($datefields as $datefield) -{ - $checked = ''; - if (isset($_POST[$datefield.'-check'])) - { - $checked = ' checked="checked"'; - } - - $after_checked = ''; - if (isset($_POST[$datefield.'-after-check'])) - { - $after_checked = ' checked="checked"'; - } - - $before_checked = ''; - if (isset($_POST[$datefield.'-before-check'])) - { - $before_checked = ' checked="checked"'; - } - - $after_included_check = ''; - if (isset($_POST[$datefield.'-after-included'])) - { - $after_included_check = ' checked="checked"'; - } - - $before_included_check = ''; - if (isset($_POST[$datefield.'-before-included'])) - { - $before_included_check = ' checked="checked"'; - } - - $template->assign_block_vars( - 'datefield', - array('NAME'=>$datefield, - 'L_NAME'=>$lang['search_'.$datefield], - 'CHECKED'=>$checked, - 'AFTER_CHECKED'=>$after_checked, - 'BEFORE_CHECKED'=>$before_checked, - 'AFTER_INCLUDED_CHECKED'=>$after_included_check, - 'BEFORE_INCLUDED_CHECKED'=>$before_included_check - )); - display_3dates($datefield); -} //------------------------------------------------------------- categories form $query = ' SELECT name,id,date_last,nb_images,global_rank,uppercats @@ -348,57 +210,10 @@ SELECT name,id,date_last,nb_images,global_rank,uppercats } $query.= ' ;'; + $selecteds = array(); -if (isset($_POST['submit'])) -{ - $selecteds = $_POST['cat']; -} display_select_cat_wrapper($query, $selecteds, 'category_option', false); -$categories_selected = ''; -if (isset($_POST['categories-check'])) -{ - $categories_selected = 'checked="checked"'; -} - -$categories_subcats_selected = ''; -if (isset($_POST['subcats-included'])) -{ - $categories_subcats_selected = 'checked="checked"'; -} - -$template->assign_vars( - array( - 'CATEGORIES_SELECTED'=>$categories_selected, - 'CATEGORIES_SUBCATS_SELECTED'=>$categories_subcats_selected - ) - ); -//---------------------------------------------------------------------- OR/AND -if (isset($_POST['mode'])) -{ - if ($_POST['mode'] == 'AND') - { - $and_checked = 'checked="checked"'; - $or_checked = ''; - } - else - { - $or_checked = 'checked="checked"'; - $and_checked = ''; - } -} -else -{ - $or_checked = 'checked="checked"'; - $and_checked = ''; -} - -$template->assign_vars( - array( - 'OR_CHECKED'=>$or_checked, - 'AND_CHECKED'=>$and_checked - ) - ); //-------------------------------------------------------------- errors display if (sizeof($errors) != 0) { diff --git a/template/default/default.css b/template/default/default.css index abf187d63..d1f0aa84c 100644 --- a/template/default/default.css +++ b/template/default/default.css @@ -78,6 +78,10 @@ a.thumbLink:hover { text-decoration:none;} /* Navigation styles */ +.small{ + font-size:10px; +} + .titreMenu,.titrePage { padding-right: 10px; @@ -322,10 +326,7 @@ color : #FFF48E; text-align:center; font-size:16px; } -.menuInfoCat { - font-family:sans-serif; - font-size:11px; -} + .totalImages { text-align:center; margin-top:5px; @@ -333,12 +334,6 @@ color : #FFF48E; font-size:11px; } -.infoCat { - margin-top:10px; - margin-bottom:10px; - text-align:left; -} - .copyright { font-size:10px; text-align:center; @@ -424,36 +419,4 @@ div.remoteLocal { /* for debugging purpose */ pre { text-align:left; -} - -.confMenu { - background-color:#444444; - text-align:center; -} - -.confMenu a { - padding:2px; - border:1px solid gray; - background-color:#505050; - color:#fff48e; - color:lightgray; -} - -.confMenu a:hover { - color:orange; - text-decoration:none; -} - -.confMenu a.opened { - background-color:gray; - color:white; - text-decoration:none; -} - -.optionTrue { - color:lightgreen; -} - -.optionFalse { - color:#ffe1e1; } \ No newline at end of file diff --git a/template/default/search.tpl b/template/default/search.tpl index dfb465528..d79aeb017 100644 --- a/template/default/search.tpl +++ b/template/default/search.tpl @@ -1,6 +1,6 @@ -
{L_TITLE}
+
{L_SEARCH_TITLE}

-
+
    @@ -10,109 +10,95 @@
- - - - - - +
{textfield.L_NAME} * - - {L_SEARCH_OR} - {L_SEARCH_AND} -
+ + - - - + + + - - - - - + + + - + + + - - - - - + + + + + + + + + + + + + + + + +
{L_SEARCH_TITLE}
* {L_SEARCH_COMMENTS}
{L_SEARCH_KEYWORDS} :
{L_SEARCH_KEYWORDS_HINT}
+ +
+ {L_SEARCH_ALL_TERMS}
+ {L_SEARCH_ANY_TERMS} +
{datefield.L_NAME} - - - - - - - - - - - - - -
{L_SEARCH_DATE_IS} - - - -
{L_SEARCH_DATE_IS_AFTER} - - - - {L_SEARCH_DATE_INCLUDED} -
{L_SEARCH_DATE_IS_BEFORE} - - - - {L_SEARCH_DATE_INCLUDED} -
-
{L_SEARCH_AUTHOR} :
{L_SEARCH_AUTHOR_HINT}
+ +
{L_SEARCH_DATE} :
{L_SEARCH_DATE_HINT}
+
+ {L_SEARCH_DATE_FROM} : + {S_CALENDAR_DAY}{S_CALENDAR_MONTH}{S_CALENDAR_YEAR}  + {L_TODAY} +
+ {L_SEARCH_DURATION} : +  {L_DAYS} +
+
{L_SEARCH_CATEGORIES} -
{L_SEARCH_OPTIONS}
{L_SEARCH_CATEGORIES} :
{L_SEARCH_CATEGORIES_HINT}
+ - {L_SEARCH_SUBCATS_INCLUDED} - {L_SEARCH_SUBFORUMS} : + {L_YES}   + {L_NO} +
{L_SEARCH_DATE_TYPE} : + {L_SEARCH_CREATION}
+ {L_SEARCH_AVAILABILITY} +
{L_RESULT_SORT} : + {L_SORT_ASCENDING}
+ {L_SORT_DESCENDING} +
+   + +
- {L_SEARCH_OR_CLAUSES} - {L_SEARCH_AND_CLAUSES}

-

+
[ {L_RETURN} ] -- cgit v1.2.3