Changeset 28707
- Timestamp:
- Jun 16, 2014, 3:53:16 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/search.php
r28587 r28707 84 84 } 85 85 86 if ($_POST['search_author']) 87 { 86 if (isset($_POST['authors']) and is_array($_POST['authors']) and count($_POST['authors']) > 0) 87 { 88 $authors = array(); 89 90 foreach ($_POST['authors'] as $author) 91 { 92 $authors[] = strip_tags($author); 93 } 94 88 95 $search['fields']['author'] = array( 89 'words' => preg_split( 90 '/\s+/', 91 strip_tags($_POST['search_author']) 92 ), 96 'words' => $authors, 93 97 'mode' => 'OR', 94 98 ); … … 210 214 ); 211 215 } 216 217 // authors 218 $query = ' 219 SELECT 220 author, 221 COUNT(*) AS counter 222 FROM '.IMAGES_TABLE.' AS i 223 JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON ic.image_id = i.id 224 '.get_sql_condition_FandF( 225 array( 226 'forbidden_categories' => 'category_id', 227 'visible_categories' => 'category_id', 228 'visible_images' => 'ic.image_id' 229 ), 230 ' WHERE ' 231 ).' 232 AND author IS NOT NULL 233 GROUP BY author 234 ORDER BY author 235 ;'; 236 $authors = query2array($query); 237 238 $template->assign('AUTHORS', $authors); 212 239 213 240 //------------------------------------------------------------- categories form -
trunk/themes/default/template/search.tpl
r28497 r28707 3 3 {include file='include/resize.inc.tpl'} 4 4 *} 5 6 {combine_script id='jquery.selectize' load='footer' path='themes/default/js/plugins/selectize.min.js'} 7 {combine_css id='jquery.selectize' path="themes/default/js/plugins/selectize.dark.css"} 8 9 {footer_script} 10 jQuery(document).ready(function() { 11 jQuery("#authors").selectize({ 12 plugins: ['remove_button'] 13 }); 14 }); 15 {/footer_script} 5 16 6 17 {if isset($MENUBAR)}{$MENUBAR}{/if} … … 34 45 </ul> 35 46 <label>{'Search for Author'|@translate} 36 <input type="text" name="search_author" size="35"> 47 <select id="authors" placeholder="{'Type in a search term'|translate}" name="authors[]" multiple style="width:500px;"> 48 {foreach from=$AUTHORS item=author} 49 <option value="{$author.author|strip_tags:false|escape:html}">{$author.author|strip_tags:false} ({'%d photos'|translate:$author.counter})</option> 50 {/foreach} 51 </select> 37 52 </label> 38 53 </fieldset> -
trunk/themes/default/theme.css
r27882 r28707 508 508 padding: 1em; 509 509 margin: 1em; 510 overflow: hidden; /* <- makes Opera happy */511 510 } 512 511
Note: See TracChangeset
for help on using the changeset viewer.