mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-06-02 04:15:05 +02:00
issue #2132 album selector hierarchy added to search page
This commit is contained in:
@@ -32,8 +32,7 @@ function linked_albums_search(searchText) {
|
||||
}
|
||||
}
|
||||
|
||||
console.log('lalalal');
|
||||
console.log(api_method);
|
||||
// console.log(api_method);
|
||||
|
||||
$(".linkedAlbumPopInContainer .searching").show();
|
||||
$.ajax({
|
||||
@@ -66,3 +65,70 @@ function linked_albums_search(searchText) {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function prefill_search() {
|
||||
$(".linkedAlbumPopInContainer .searching").show();
|
||||
if (api_method == "pwg.categories.getList") {
|
||||
api_params = {
|
||||
cat_id: 0,
|
||||
recursive: false,
|
||||
fullname: true,
|
||||
limit: limit_params,
|
||||
};
|
||||
} else {
|
||||
api_params = {
|
||||
additional_output: "full_name_with_admin_links",
|
||||
};
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: "ws.php?format=json&method=" + api_method,
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
data: api_params,
|
||||
success: function (data) {
|
||||
// for debug
|
||||
// console.log(data);
|
||||
$(".linkedAlbumPopInContainer .searching").hide();
|
||||
const cats = data.result.categories;
|
||||
const limit = data.result.limit;
|
||||
prefill_results("root", cats, limit);
|
||||
},
|
||||
error: function (e) {
|
||||
$(".linkedAlbumPopInContainer .searching").hide();
|
||||
console.log("error : ", e.message);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
async function prefill_search_subcats(cat_id) {
|
||||
let method = {};
|
||||
if (api_method == "pwg.categories.getList") {
|
||||
method = {
|
||||
cat_id: cat_id,
|
||||
recursive: false,
|
||||
limit: limit_params,
|
||||
};
|
||||
} else {
|
||||
method = {
|
||||
additional_output: "full_name_with_admin_links",
|
||||
};
|
||||
}
|
||||
|
||||
try {
|
||||
const data = await $.ajax({
|
||||
url: "ws.php?format=json&method=" + api_method,
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
data: method,
|
||||
});
|
||||
|
||||
// for debug
|
||||
// console.log(data);
|
||||
const cats = data.result.categories.filter((c) => c.id !== +cat_id);
|
||||
const limit = data.result.limit;
|
||||
prefill_results(cat_id, cats, limit);
|
||||
} catch (e) {
|
||||
console.log("error", e.message);
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,8 @@
|
||||
{if !isset($show_root_btn)}{$show_root_btn=false}{/if}
|
||||
|
||||
{include file='include/colorbox.inc.tpl' load_mode=$load_mode}
|
||||
{combine_script id='albumSelector' load_mode=$load_mode path='admin/themes/default/js/album_selector.js'}
|
||||
{combine_script id='albumSelector' load=$load_mode path='admin/themes/default/js/album_selector.js'}
|
||||
{combine_script id='common' load='footer' path='admin/themes/default/js/common.js'}
|
||||
{footer_script}
|
||||
str_no_search_in_progress = '{'No search in progress'|@translate|escape:javascript}';
|
||||
str_albums_found = '{"<b>%d</b> albums found"|translate}';
|
||||
@@ -14,6 +15,9 @@
|
||||
api_method = 'pwg.categories.getAdminList';
|
||||
{/if}
|
||||
|
||||
const limit_params = 50;
|
||||
const str_plus_albums_found = "{'Only the first %d albums are displayed, out of %d.'|@translate|escape:javascript}"
|
||||
const str_album_selected = "{'Album already selected'|@translate|escape:javascript}"
|
||||
{/footer_script}
|
||||
|
||||
<div id="addLinkedAlbum" class="linkedAlbumPopIn">
|
||||
|
||||
Reference in New Issue
Block a user