issue #1955 search in this set (an album or some tags)

This commit is contained in:
plegall
2023-08-12 16:49:42 +02:00
parent 3c5c62869a
commit 2c3b6ba6ec
12 changed files with 100 additions and 2 deletions
+2
View File
@@ -72,6 +72,8 @@ $comments_checkboxes = array(
$display_checkboxes = array(
'menubar_filter_icon',
'index_search_in_set_button',
'index_search_in_set_action',
'index_sort_order_input',
'index_flat_icon',
'index_posted_date_icon',
@@ -40,6 +40,22 @@
</label>
</li>
<li>
<label class="font-checkbox">
<span class="icon-check"></span>
<input type="checkbox" name="index_search_in_set_button" {if ($display.index_search_in_set_button)}checked="checked"{/if}>
{'Activate button "%s"'|translate:('Search in this set'|translate)}
</label>
</li>
<li>
<label class="font-checkbox">
<span class="icon-check"></span>
<input type="checkbox" name="index_search_in_set_action" {if ($display.index_search_in_set_action)}checked="checked"{/if}>
{'Activate icon "%s"'|translate:('Search in this set'|translate)}
</label>
</li>
<li>
<label class="font-checkbox">
<span class="icon-check"></span>
+22
View File
@@ -416,6 +416,28 @@ SELECT
*/
}
if ('categories' == $page['section'] and isset($page['category']) and !isset($page['combined_categories']))
{
$template->assign(
array(
'SEARCH_IN_SET_BUTTON' => $conf['index_search_in_set_button'],
'SEARCH_IN_SET_ACTION' => $conf['index_search_in_set_action'],
'SEARCH_IN_SET_URL' => get_root_url().'search.php?cat_id='.$page['category']['id'],
)
);
}
if (isset($page['body_data']['tag_ids']))
{
$template->assign(
array(
'SEARCH_IN_SET_BUTTON' => $conf['index_search_in_set_button'],
'SEARCH_IN_SET_ACTION' => $conf['index_search_in_set_action'],
'SEARCH_IN_SET_URL' => get_root_url().'search.php?tag_id='.implode(',', $page['body_data']['tag_ids']),
)
);
}
if (isset($page['category']) and is_admin() and $conf['index_edit_icon'])
{
$template->assign(
+2
View File
@@ -75,3 +75,5 @@ INSERT INTO piwigo_config (param,value) VALUES ('picture_caddie_icon','true');
INSERT INTO piwigo_config (param,value) VALUES ('picture_representative_icon','true');
INSERT INTO piwigo_config (param,value) VALUES ('show_mobile_app_banner_in_admin','true');
INSERT INTO piwigo_config (param,value) VALUES ('show_mobile_app_banner_in_gallery','false');
INSERT INTO piwigo_config (param,value) VALUES ('index_search_in_set_button','true');
INSERT INTO piwigo_config (param,value) VALUES ('index_search_in_set_action','true');
+21
View File
@@ -0,0 +1,21 @@
<?php
// +-----------------------------------------------------------------------+
// | This file is part of Piwigo. |
// | |
// | For copyright and license information, please view the COPYING.txt |
// | file that was distributed with this source code. |
// +-----------------------------------------------------------------------+
if (!defined('PHPWG_ROOT_PATH'))
{
die('Hacking attempt!');
}
$upgrade_description = 'add config parameters to display "search in this set" action and button';
conf_update_param('index_search_in_set_button', true);
conf_update_param('index_search_in_set_action', true);
echo "\n".$upgrade_description."\n";
?>
+1
View File
@@ -1347,4 +1347,5 @@ $lang['This album is currently locked, visible only to administrators.'] = 'This
$lang['Unlock it'] = 'Unlock it';
$lang['All admins'] = 'All admins';
$lang['Only admins in a specific group'] = 'Only admins in a specific group';
$lang['Activate button "%s"'] = 'Activate button "%s"';
// Leave this line empty
+1
View File
@@ -436,4 +436,5 @@ $lang['last year'] = 'Last year';
$lang['Unknown time period'] = 'Unknown time period';
$lang['Tags found'] = 'Tags found';
$lang['Albums found'] = 'Albums found';
$lang['Search in this set'] = 'Search in this set';
?>
+1
View File
@@ -1347,4 +1347,5 @@ $lang['This album is currently locked, visible only to administrators.'] = 'Cet
$lang['Unlock it'] = 'Le déverrouiller';
$lang['All admins'] = 'Tous les administrateurs';
$lang['Only admins in a specific group'] = 'Uniquement les administrations d\'un groupe spécifique';
$lang['Activate button "%s"'] = 'Afficher le bouton "%s"';
// Leave this line empty
+1
View File
@@ -441,3 +441,4 @@ $lang['last year'] = 'Dernière année';
$lang['Unknown time period'] = 'Période inconnue';
$lang['Tags found'] = 'Tags trouvés';
$lang['Albums found'] = 'Albums trouvés';
$lang['Search in this set'] = 'Rechercher dans ce lot';
+16 -2
View File
@@ -28,6 +28,13 @@ if (!empty($_GET['q']))
$words = split_allwords($_GET['q']);
}
$cat_ids = array();
if (isset($_GET['cat_id']))
{
check_input_parameter('cat_id', $_GET, false, PATTERN_ID);
$cat_ids = array($_GET['cat_id']);
}
$search = array(
'mode' => 'AND',
'fields' => array(
@@ -37,7 +44,7 @@ $search = array(
'fields' => array('file', 'name', 'comment', 'tags', 'cat-title', 'cat-desc'),
),
'cat' => array(
'words' => array(),
'words' => $cat_ids,
'sub_inc' => true,
),
),
@@ -45,8 +52,15 @@ $search = array(
if (count(get_available_tags()) > 0)
{
$tag_ids = array();
if (isset($_GET['tag_id']))
{
check_input_parameter('tag_id', $_GET, false, '/^\d+(,\d+)*$/');
$tag_ids = explode(',', $_GET['tag_id']);
}
$search['fields']['tags'] = array(
'words' => array(),
'words' => $tag_ids,
'mode' => 'AND',
);
}
+13
View File
@@ -15,6 +15,11 @@
<div id="content" class="content{if isset($MENUBAR)} contentWithMenu{/if}">
<div class="titrePage{if isset($chronology.TITLE)} calendarTitleBar{/if}">
<ul class="categoryActions">
{if isset($SEARCH_IN_SET_ACTION) and $SEARCH_IN_SET_ACTION}
<li id="cmdSearchInSet"><a href="{$SEARCH_IN_SET_URL}" title="{'Search in this set'|translate}" class="pwg-state-default pwg-button">
<span class="pwg-icon pwg-icon-search"></span><span class="pwg-button-text">{'Search in this set'|translate}</span>
</a></li>
{/if}
{if !empty($image_orders)}
<li>{strip}<a id="sortOrderLink" title="{'Sort order'|@translate}" class="pwg-state-default pwg-button" rel="nofollow">
<span class="pwg-icon pwg-icon-sort"></span><span class="pwg-button-text">{'Sort order'|@translate}</span>
@@ -154,6 +159,14 @@
{include file=$FILE_CHRONOLOGY_VIEW}
{/if}
{if isset($SEARCH_IN_SET_BUTTON) and $SEARCH_IN_SET_BUTTON}
<div class="mcs-side-results search-in-set-button">
<div>
<p><a href="{$SEARCH_IN_SET_URL}" class="pwg-icon-search">{'Search in this set'|translate}</a></p>
</div>
</div>
{/if}
{if !empty($CONTENT_DESCRIPTION)}
<div class="additional_info">
{$CONTENT_DESCRIPTION}
+4
View File
@@ -1499,6 +1499,10 @@ LEGEND {
background: #777;
}
.mcs-side-results.search-in-set-button {
margin-top:0;
}
.ClosePopIn:hover {
text-decoration: none;
color: white;