diff --git a/admin/themes/default/js/album_selector.js b/admin/themes/default/js/album_selector.js index 6b9825916..9cc0b319d 100644 --- a/admin/themes/default/js/album_selector.js +++ b/admin/themes/default/js/album_selector.js @@ -23,6 +23,7 @@ function linked_albums_search(searchText) { cat_id: 0, recursive: true, fullname: true, + search: searchText, } } else { api_params = { @@ -64,4 +65,4 @@ function linked_albums_search(searchText) { console.log(e.message); } }) -} \ No newline at end of file +} diff --git a/include/ws_functions/pwg.categories.php b/include/ws_functions/pwg.categories.php index 897d4d416..ae4f31a19 100644 --- a/include/ws_functions/pwg.categories.php +++ b/include/ws_functions/pwg.categories.php @@ -279,7 +279,16 @@ SELECT FROM '. CATEGORIES_TABLE .' '.$join_type.' JOIN '. USER_CACHE_CATEGORIES_TABLE .' ON id=cat_id AND user_id='.$join_user.' - WHERE '. implode("\n AND ", $where) .' + WHERE '. implode("\n AND ", $where); + + if (isset($params["search"]) and $params['search'] != "") + { + $query .= ' + AND name LIKE \'%'.pwg_db_real_escape_string($params["search"]).'%\' + LIMIT '.$conf["linked_album_search_limit"]; + } + + $query.= ' ;'; $result = pwg_query($query); diff --git a/ws.php b/ws.php index cbb8d683d..e3c2116cb 100644 --- a/ws.php +++ b/ws.php @@ -157,6 +157,7 @@ function ws_addDefaultMethods( $arr ) 'default' => IMG_THUMB, 'info' => implode(',', array_keys(ImageStdParams::get_defined_type_map())) ), + 'search' => array('default' => null), ), 'Returns a list of categories.', $ws_functions_root . 'pwg.categories.php'