related to #1703 added params in ws.php and pagination works but filters don't

This commit is contained in:
Matthieu Leproux 2022-08-03 16:33:43 +02:00
parent 1ed159f7a7
commit 697b240b5c
3 changed files with 49 additions and 8 deletions

View file

@ -195,13 +195,13 @@ function fillHistoryResult(ajaxParam) {
$(".tab").empty();
},
success: function (raw_data) {
console.log(raw_data);
data = raw_data.result["lines"];
imageDisplay = raw_data.result["params"].display_thumbnail;
maxPage = raw_data.result["maxPage"];
summary = raw_data.result["summary"];
// console.log(raw_data);
//clear lines before refill
if (data.length > 0) {

View file

@ -607,6 +607,10 @@ function ws_history_search($param, &$service)
$page['start'] = 0;
}
$page['start'] = $param['pageNumber'];
// print_r("page start :");
// print_r($page['start']);
$types = array_merge(array('none'), get_enums(HISTORY_TABLE, 'image_type'));
$display_thumbnails = array('no_display_thumbnail' => l10n('No display'),
@ -838,8 +842,8 @@ SELECT
}
}
$i = 0;
$first_line = $page['start'] + 1;
$i = $page['start'];
$first_line = $page['start'];
$last_line = $page['start'] + $conf['nb_logs_page'];
$summary['total_filesize'] = 0;
@ -867,7 +871,7 @@ SELECT
$i++;
if ($i < $first_line or $i > $last_line)
if ($i >= $first_line and $i <= $last_line)
{
continue;
}
@ -972,7 +976,8 @@ SELECT
);
}
$max_page = ceil(count($result)/300);
// print_r(count($result));
$max_page = ceil($page['nb_lines']/300);
$result = array_reverse($result, true);
$result = array_slice($result, $param['pageNumber']*300, 300);

38
ws.php
View file

@ -1296,7 +1296,43 @@ enabled_high, registration_date, registration_date_string, registration_date_sin
$service->addMethod(
'pwg.history.search',
'ws_history_search',
null,
array(
'start' => array(
'default' => null
),
'end' => array(
'default' => null
),
'types' => array(
'flags'=>WS_PARAM_FORCE_ARRAY,
'default' => array(
'none',
'picture',
'high',
'other',
)
),
'user' => array(
'default' => -1,
),
'image_id' => array(
'default' => null,
'type' => WS_TYPE_ID,
),
'filename' => array(
'default' => null
),
'ip' => array(
'default' => null
),
'display_thumbnail' => array(
'default' => 'display_thumbnail_classic'
),
'pageNumber' => array(
'default' => null,
'type' => WS_TYPE_INT|WS_TYPE_POSITIVE,
),
),
'Gives an history of who has visited the galery and the actions done in it. Receives parameter.',
$ws_functions_root . 'pwg.php'
);