Skip to content

Commit 45fd1fd

Browse files
committed
allow setting number of tags to download
1 parent 26c6e71 commit 45fd1fd

File tree

4 files changed

+34
-8
lines changed

4 files changed

+34
-8
lines changed

language/en_UK/plugin.lang.php

+4
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,7 @@
2727
$lang['Groups'] = 'Groups';
2828
$lang['Type in a search term'] = 'Type in a search term';
2929
$lang['The following groups can use MugShot to tag people'] = 'The following groups can use MugShot to tag people';
30+
$lang['MugShot to crop tagged faces from photos'] = 'MugShot to crop tagged faces from photos';
31+
$lang['ALLOW'] = 'ALLOW';
32+
$lang['DO NOT ALLOW'] = 'DO NOT ALLOW';
33+
$lang['Maximum number of tags to load client side for auto complete functionality'] = 'Maximum number of tags to load client side for auto complete functionality';

language/en_US/plugin.lang.php

+4
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,7 @@
2727
$lang['Groups'] = 'Groups';
2828
$lang['Type in a search term'] = 'Type in a search term';
2929
$lang['The following groups can use MugShot to tag people'] = 'The following groups can use MugShot to tag people';
30+
$lang['MugShot to crop tagged faces from photos'] = 'MugShot to crop tagged faces from photos';
31+
$lang['ALLOW'] = 'ALLOW';
32+
$lang['DO NOT ALLOW'] = 'DO NOT ALLOW';
33+
$lang['Maximum number of tags to load client side for auto complete functionality'] = 'Maximum number of tags to load client side for auto complete functionality';

main.inc.php

+7-3
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@ function query_mugshot_groups() {
143143
/*
144144
* Queries all tags in database
145145
*/
146-
function defined_tags() {
147-
$sql = 'SELECT name FROM ' . TAGS_TABLE . ' ORDER BY lastmodified ASC LIMIT 100;';
146+
function defined_tags($max_tags) {
147+
$sql = 'SELECT name FROM ' . TAGS_TABLE . " ORDER BY lastmodified ASC LIMIT $max_tags;";
148148

149149
$x = fetch_sql($sql, 'name', false);
150150

@@ -235,10 +235,14 @@ function insert_tag_list() {
235235

236236
global $template;
237237

238+
$plugin_config = unserialize(conf_get_param(MUGSHOT_ID));
239+
240+
$max_tags = $plugin_config['max_tags'] ?? 500;
241+
238242
/*
239243
* Array of tags
240244
*/
241-
$template -> assign('MUGSHOT_TAG_LIST', defined_tags());
245+
$template -> assign('MUGSHOT_TAG_LIST', defined_tags($max_tags));
242246

243247
/*
244248
* Specify the tag list template file

template/admin.tpl

+19-5
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@
1515
input[type="radio"] {
1616
margin-right: 10px;
1717
}
18+
.tagbox {
19+
width:581px;
20+
height:1.25em;
21+
padding:5px 8px 2px;
22+
border:1px solid #787777a6;
23+
margin-right:25px;
24+
background: white;
25+
}
1826
{/literal}{/html_style}
1927

2028
{combine_script id='LocalStorageCache' load='footer' path='admin/themes/default/js/LocalStorageCache.js'}
@@ -57,17 +65,23 @@ jQuery(document).ready(function() {
5765
{/if}
5866
</p>
5967

68+
<p><br>
69+
<label for="max_tags">
70+
<strong>{'Maximum number of tags to load client side for auto complete functionality'|@translate}</strong><br><br>
71+
<input id="max_tags" type="text" size="2" maxlength="3" name="max_tags" value="{$max_tags|default:'500'}" class="tagbox nice">
72+
</p>
73+
6074
<!-- Enable automatic cropping of tagged faces -->
6175
<p><br>
6276
<label for="autotag">
6377
<strong>{'Enable cropping of faces for automated tagging'|@translate}</strong><br>
64-
<i>This requires ImageMagick to be installed, including the PHP plugin</i><br><br>
78+
<i>{'This requires ImageMagick to be installed, including the PHP plugin'|@translate}</i><br><br>
6579
{if $autotag }
66-
<input type="radio" id="autotag1" name="autotag" value="1" checked /><b><i>ALLOW</i></b> MugShot to crop tagged faces from photos<br>
67-
<input type="radio" id="autotag2" name="autotag" value="0"/><b><i>DO NOT ALLOW</i></b> MugShot to crop tagged faces from photos<br>
80+
<input type="radio" id="autotag1" name="autotag" value="1" checked /><b><i>{'ALLOW'|@translate}</i></b> {'MugShot to crop tagged faces from photos'|@translate}<br>
81+
<input type="radio" id="autotag2" name="autotag" value="0"/><b><i>D{'DO NOT ALLOW'|@translate}</i></b> {'MugShot to crop tagged faces from photos'|@translate}<br>
6882
{else}
69-
<input type="radio" id="autotag1" name="autotag" value="1"/><b><i>ALLOW</i></b> MugShot to crop tagged faces from photos<br>
70-
<input type="radio" id="autotag2" name="autotag" value="0" checked /><b><i>DO NOT ALLOW</i></b> MugShot to crop tagged faces from photos<br>
83+
<input type="radio" id="autotag1" name="autotag" value="1"/><b><i>{'ALLOW'|@translate}</i></b> {'MugShot to crop tagged faces from photos'|@translate}<br>
84+
<input type="radio" id="autotag2" name="autotag" value="0" checked /><b><i>{'DO NOT ALLOW'|@translate}</i></b> {'MugShot to crop tagged faces from photos'|@translate}<br>
7185
{/if}
7286
</label>
7387
</p><br>

0 commit comments

Comments
 (0)