diff options
author | rvelices <rv-github@modusoptimus.com> | 2006-04-05 02:01:36 +0000 |
---|---|---|
committer | rvelices <rv-github@modusoptimus.com> | 2006-04-05 02:01:36 +0000 |
commit | bdceff32bcdd7a6ed72697384148577da4bc71d1 (patch) | |
tree | 10a99a67fa7c8685aab8bb213a4c0252bd48d30a | |
parent | db80e86df1d0708c18255c7e993a224ce6589b2a (diff) |
image sort order for tags
very minor code and language simplifications and corrections
git-svn-id: http://piwigo.org/svn/trunk@1125 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r-- | include/functions_calendar.inc.php | 5 | ||||
-rw-r--r-- | include/section_init.inc.php | 16 | ||||
-rw-r--r-- | install/db/19-database.php | 4 | ||||
-rw-r--r-- | language/en_UK.iso-8859-1/common.lang.php | 1 | ||||
-rw-r--r-- | language/en_UK.iso-8859-1/help/notification_by_mail.html | 4 | ||||
-rw-r--r-- | language/fr_FR.iso-8859-1/common.lang.php | 1 | ||||
-rw-r--r-- | search.php | 43 | ||||
-rw-r--r-- | template/yoga/search.tpl | 50 |
8 files changed, 48 insertions, 76 deletions
diff --git a/include/functions_calendar.inc.php b/include/functions_calendar.inc.php index f8bec93e0..1c86c679e 100644 --- a/include/functions_calendar.inc.php +++ b/include/functions_calendar.inc.php @@ -37,7 +37,6 @@ function initialize_calendar() if ($page['section']=='categories' or ( isset($page['category']) and is_numeric($page['category']) ) ) { // we will regenerate the items by including subcats elements - $page['cat_nb_images'] = 0; $page['items'] = array(); $inner_sql .= ' INNER JOIN '.IMAGE_CATEGORY_TABLE.' ON id = image_id'; @@ -186,8 +185,7 @@ WHERE id IN (' . implode(',',$page['items']) .')'; { unset( $page['thumbnails_include'], - $page['items'], - $page['cat_nb_images'] + $page['items'] ); $must_show_list = false; @@ -270,7 +268,6 @@ WHERE id IN (' . implode(',',$page['items']) .')'; } $page['items'] = array_from_query($query, 'id'); - $page['cat_nb_images'] = count($page['items']); $page['thumbnails_include'] = 'include/category_default.inc.php'; } pwg_debug('end initialize_calendar'); diff --git a/include/section_init.inc.php b/include/section_init.inc.php index 176ebf0f0..e22979e69 100644 --- a/include/section_init.inc.php +++ b/include/section_init.inc.php @@ -2,7 +2,7 @@ // +-----------------------------------------------------------------------+ // | PhpWebGallery - a PHP based picture gallery | // | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net | -// | Copyright (C) 2003-2005 PhpWebGallery Team - http://phpwebgallery.net | +// | Copyright (C) 2003-2006 PhpWebGallery Team - http://phpwebgallery.net | // +-----------------------------------------------------------------------+ // | branch : BSF (Best So Far) // | file : $Id$ @@ -298,7 +298,6 @@ if ('categories' == $page['section']) 'comment' => $result['comment'], 'cat_dir' => $result['dir'], 'cat_name' => $result['name'], - 'cat_nb_images' => $result['nb_images'], 'cat_site_id' => $result['site_id'], 'cat_uploadable' => $result['uploadable'], 'cat_commentable' => $result['commentable'], @@ -364,9 +363,10 @@ else { $query = ' SELECT image_id - FROM '.IMAGE_CATEGORY_TABLE.' + FROM '.IMAGE_CATEGORY_TABLE.' INNER JOIN '.IMAGES_TABLE.' ON image_id=id WHERE image_id IN ('.implode(',', $items).') - AND '.$forbidden.' + AND '.$forbidden. + $conf['order_by'].' ;'; $items = array_unique( array_from_query($query, 'image_id') @@ -511,7 +511,6 @@ SELECT DISTINCT(id) $page, array( 'title' => $lang['recent_cats_cat'], - 'cat_nb_images' => 0, 'thumbnails_include' => 'include/category_recent_cats.inc.php', ) ); @@ -591,11 +590,6 @@ SELECT DISTINCT(id) ) ); } - - if (!isset($page['cat_nb_images'])) - { - $page['cat_nb_images'] = count($page['items']); - } } // +-----------------------------------------------------------------------+ @@ -608,6 +602,8 @@ if (isset($page['chronology_field'])) initialize_calendar(); } +$page['cat_nb_images'] = isset($page['items']) ? count($page['items']) : 0; + if (basename($_SERVER['SCRIPT_FILENAME']) == 'picture.php' and !isset($page['image_id']) ) { diff --git a/install/db/19-database.php b/install/db/19-database.php index 035aff95a..d1fdb4a74 100644 --- a/install/db/19-database.php +++ b/install/db/19-database.php @@ -80,7 +80,7 @@ while ($row = mysql_fetch_array($result)) { $tag_id[$keyword] = $current_id++; } - + if (!isset($tag_images[ $tag_id[$keyword] ])) { $tag_images[ $tag_id[$keyword] ] = array(); @@ -102,6 +102,7 @@ foreach ($tag_id as $tag_name => $tag_id) ) ); } +if (!empty($datas)) mass_inserts( PREFIX_TABLE.'tags', array_keys($datas[0]), @@ -123,6 +124,7 @@ foreach ($tag_images as $tag_id => $images) } } +if (!empty($datas)) mass_inserts( PREFIX_TABLE.'image_tag', array_keys($datas[0]), diff --git a/language/en_UK.iso-8859-1/common.lang.php b/language/en_UK.iso-8859-1/common.lang.php index 5fffbff9a..d11d4d945 100644 --- a/language/en_UK.iso-8859-1/common.lang.php +++ b/language/en_UK.iso-8859-1/common.lang.php @@ -294,7 +294,6 @@ $lang['search_date_from'] = 'Date'; $lang['search_date_to'] = 'End-Date'; $lang['search_date_type'] = 'Kind of date'; $lang['search_descending'] = 'Descending'; -$lang['search_explain'] = 'Use * as a wildcard for partial matches'; $lang['search_keywords'] = 'Search for words'; $lang['search_mode_and'] = 'Search for all terms '; $lang['search_mode_or'] = 'Search for any terms'; diff --git a/language/en_UK.iso-8859-1/help/notification_by_mail.html b/language/en_UK.iso-8859-1/help/notification_by_mail.html index 106c5a736..076bb7b34 100644 --- a/language/en_UK.iso-8859-1/help/notification_by_mail.html +++ b/language/en_UK.iso-8859-1/help/notification_by_mail.html @@ -1,6 +1,6 @@ <h2>Notification by mail</h2> -<p>This screen allows to configure, to manage the notification to users of news sendinf mail.</p> +<p>This screen allows to configure and manage email notifications to users of news on your site.</p> <p>This screen is composed of 3 tabs:</p> @@ -8,7 +8,7 @@ <p>Available only for webmasters, this tab sets parameters of the notification by mail.</p> <h3>Subscribe</h3> -<p>Available only for webmasters, this tab manages subscribe/unsubscribe of notification by mail.</p> +<p>Available only for webmasters, this tab manages subscription/unsubscription of users to email notifications.</p> <h3>Envoi</h3> <p>Available only for webmasters and administrators, this tab allows to send mails to notify news.</p> diff --git a/language/fr_FR.iso-8859-1/common.lang.php b/language/fr_FR.iso-8859-1/common.lang.php index 45e00ad2c..df9e3be66 100644 --- a/language/fr_FR.iso-8859-1/common.lang.php +++ b/language/fr_FR.iso-8859-1/common.lang.php @@ -294,7 +294,6 @@ $lang['search_date_from'] = 'Date'; $lang['search_date_to'] = 'Date de fin'; $lang['search_date_type'] = 'Type de date'; $lang['search_descending'] = 'Décroissant'; -$lang['search_explain'] = 'Utiliser * comme un joker pour une recherche partielle'; $lang['search_keywords'] = 'Recherche de mot'; $lang['search_mode_and'] = 'Rechercher tous les mots'; $lang['search_mode_or'] = 'Rechercher un des mots'; diff --git a/search.php b/search.php index 2d6ce0c8f..cc461f6df 100644 --- a/search.php +++ b/search.php @@ -2,7 +2,7 @@ // +-----------------------------------------------------------------------+ // | PhpWebGallery - a PHP based picture gallery | // | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net | -// | Copyright (C) 2003-2005 PhpWebGallery Team - http://phpwebgallery.net | +// | Copyright (C) 2003-2006 PhpWebGallery Team - http://phpwebgallery.net | // +-----------------------------------------------------------------------+ // | branch : BSF (Best So Far) // | file : $RCSfile$ @@ -72,7 +72,7 @@ if (isset($_POST['submit'])) 'mode' => $_POST['tag_mode'], ); } - + if ($_POST['search_author']) { $search['fields']['author'] = array( @@ -176,32 +176,15 @@ $page['body_id'] = 'theSearchPage'; include(PHPWG_ROOT_PATH.'include/page_header.php'); $template->set_filenames( array('search'=>'search.tpl') ); -$template->assign_vars(array( - 'L_SEARCH_TITLE' => $lang['search_title'], - 'L_SEARCH_OPTIONS' => $lang['search_options'], - 'L_RETURN' => $lang['home'], - 'L_SUBMIT' => $lang['submit'], - 'L_RESET' => $lang['reset'], - 'L_SEARCH_KEYWORDS'=>$lang['search_keywords'], - '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_SUBFORUMS'=>$lang['search_subcats_included'], - 'L_YES' => $lang['yes'], - 'L_NO' => $lang['no'], - 'L_SEARCH_DATE' => $lang['search_date'], - 'L_TODAY' => $lang['today'], - 'L_SEARCH_DATE_FROM'=>$lang['search_date_from'], - 'L_SEARCH_DATE_TO'=>$lang['search_date_to'], - 'L_DAYS'=>$lang['days'], - 'L_MONTH'=>$lang['w_month'], - 'L_SEARCH_DATE_TYPE'=>$lang['search_date_type'], - 'L_RESULT_SORT'=>$lang['search_sort'], - 'L_SORT_ASCENDING'=>$lang['search_ascending'], - 'L_SORT_DESCENDING'=>$lang['search_descending'], +$available_tags = get_available_tags( + isset($user['forbidden_categories']) + ? explode(',', $user['forbidden_categories']) + : null + ); +usort( $available_tags, 'name_compare'); + +$template->assign_vars(array( 'TODAY_DAY' => date('d', time()), 'TODAY_MONTH' => date('m', time()), 'TODAY_YEAR' => date('Y', time()), @@ -210,11 +193,7 @@ $template->assign_vars(array( 'U_HOME' => make_index_url(), 'TAG_SELECTION' => get_html_tag_selection( - get_available_tags( - isset($user['forbidden_categories']) - ? explode(',', $user['forbidden_categories']) - : null - ), + $available_tags, 'tags', isset($_POST['tags']) ? $_POST['tags'] : array() ), diff --git a/template/yoga/search.tpl b/template/yoga/search.tpl index 6a3fb9f1e..433a2d4f0 100644 --- a/template/yoga/search.tpl +++ b/template/yoga/search.tpl @@ -21,21 +21,21 @@ <!-- END errors --> <table width="100%" align="center" cellpadding="2"> <tr> - <td width="50%" colspan="2"><b>{L_SEARCH_KEYWORDS} : </b> + <td width="50%" colspan="2"><b>{lang:search_keywords} : </b> <td colspan="2" valign="top"> <input type="text" style="width: 300px" name="search_allwords" size="30" /> <br /> - <input type="radio" name="mode" value="AND" checked="checked" /> {L_SEARCH_ALL_TERMS}<br /> - <input type="radio" name="mode" value="OR" /> {L_SEARCH_ANY_TERMS} + <input type="radio" name="mode" value="AND" checked="checked" /> {lang:search_mode_and}<br /> + <input type="radio" name="mode" value="OR" /> {lang:search_mode_or} </td> </tr> <tr> - <td colspan="2"><b>{L_SEARCH_AUTHOR} :</b> + <td colspan="2"><b>{lang:search_author} :</b> <td colspan="2" valign="middle"> <input type="text" style="width: 300px" name="search_author" size="30" /> </td> </tr> - + <tr> <td colspan="2"><b>{lang:Search tags} :</b></td> <td colspan="2" valign="middle"> @@ -44,13 +44,13 @@ <br /><label><input type="radio" name="tag_mode" value="OR" /> {lang:Any tag}</label> </td> </tr> - + <tr> - <td colspan="2"><b>{L_SEARCH_DATE} :</b> + <td colspan="2"><b>{lang:search_date} :</b> <td colspan="2" valign="middle"> <table> <tr> - <td>{L_SEARCH_DATE_FROM} :</td> + <td>{lang:search_date_from} :</td> <td> <select name="start_day"> <!-- BEGIN start_day --> @@ -63,11 +63,11 @@ <!-- END start_month --> </select> <input name="start_year" type="text" size="4" maxlength="4"> - <a href="#" name="#" onClick="document.post.start_day.value={TODAY_DAY};document.post.start_month.value={TODAY_MONTH};document.post.start_year.value={TODAY_YEAR};" />{L_TODAY}</a> + <a href="#" name="#" onClick="document.post.start_day.value={TODAY_DAY};document.post.start_month.value={TODAY_MONTH};document.post.start_year.value={TODAY_YEAR};" />{lang:today}</a> </td> </tr> <tr> - <td>{L_SEARCH_DATE_TO} :</td> + <td>{lang:search_date_to} :</td> <td> <select name="end_day"> <!-- BEGIN end_day --> @@ -80,17 +80,17 @@ <!-- END end_month --> </select> <input name="end_year" type="text" size="4" maxlength="4"> - <a href="#" name="#" onClick="document.post.end_day.value={TODAY_DAY};document.post.end_month.value={TODAY_MONTH};document.post.end_year.value={TODAY_YEAR};" />{L_TODAY}</a> + <a href="#" name="#" onClick="document.post.end_day.value={TODAY_DAY};document.post.end_month.value={TODAY_MONTH};document.post.end_year.value={TODAY_YEAR};" />{lang:today}</a> </td> </tr> </table> </td> </tr> <tr class="admin"> - <th colspan="4">{L_SEARCH_OPTIONS}</th> + <th colspan="4">{lang:search_options}</th> </tr> <tr> - <td width="25%" ><b>{L_SEARCH_CATEGORIES} : </b> + <td width="25%" ><b>{lang:search_categories} : </b> <td width="25%" nowrap="nowrap"> <select style="width:200px" name="cat[]" multiple="multiple" size="8"> <!-- BEGIN category_option --> @@ -98,22 +98,22 @@ <!-- END category_option --> </select> </td> - <td width="25%" nowrap="nowrap"><b>{L_SEARCH_SUBFORUMS} : </b></td> + <td width="25%" nowrap="nowrap"><b>{lang:search_subcats_included} : </b></td> <td width="25%" nowrap="nowrap"> - <input type="radio" name="subcats-included" value="1" checked="checked" />{L_YES} - <input type="radio" name="subcats-included" value="0" />{L_NO} + <input type="radio" name="subcats-included" value="1" checked="checked" />{lang:yes} + <input type="radio" name="subcats-included" value="0" />{lang:no} </td> </tr> <tr> - <td width="25%" nowrap="nowrap"><b>{L_SEARCH_DATE_TYPE} : </b></td> + <td width="25%" nowrap="nowrap"><b>{lang:search_date_type} : </b></td> <td width="25%" nowrap="nowrap"> <input type="radio" name="date_type" value="date_creation" checked="checked" />{lang:Creation date}<br /> <input type="radio" name="date_type" value="date_available" />{lang:Post date} </td> - <td><b>{L_RESULT_SORT} : </b></td> + <td><b>{lang:search_sort} : </b></td> <td nowrap="nowrap"> - <input type="radio" name="sd" value="AND" />{L_SORT_ASCENDING}<br /> - <input type="radio" name="sd" value="d" checked="checked" />{L_SORT_DESCENDING} + <input type="radio" name="sd" value="AND" />{lang:search_ascending}<br /> + <input type="radio" name="sd" value="d" checked="checked" />{lang:search_descending} </td> </tr> <!-- <tr> @@ -125,11 +125,11 @@ </td> </tr> <tr> - <td><b>{L_RESULT_SORT} : </b></td> + <td><b>{lang:search_sort} : </b></td> <td nowrap="nowrap"> {S_SELECT_SORT_KEY}<br /> - <input type="radio" name="sd" value="a" />{L_SORT_ASCENDING}<br /> - <input type="radio" name="sd" value="d" checked="checked" />{L_SORT_DESCENDING} + <input type="radio" name="sd" value="a" />{lang:search_ascending}<br /> + <input type="radio" name="sd" value="d" checked="checked" />{lang:search_descending} </td> <td nowrap="nowrap"><b>{L_DISPLAY_RESULTS} : </b></td> <td nowrap="nowrap"> @@ -140,8 +140,8 @@ --> <tr> <td align="center" valign="bottom" colspan="4" height="38"> -<input type="submit" name="submit" value="{L_SUBMIT}" class="bouton" /> -<input type="reset" value="{L_RESET}" class="bouton" /> +<input type="submit" name="submit" value="{lang:submit}" class="bouton" /> +<input type="reset" value="{lang:reset}" class="bouton" /> </td> </table> </form> |