Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

fix(pagination) fix filter save with pagination #7732

Merged
merged 42 commits into from
Jul 31, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
6271863
fix host
loiclau Jul 23, 2019
3205e13
fix service by host
loiclau Jul 23, 2019
ea1b3bd
fix service by hg
loiclau Jul 23, 2019
5952745
fix command
loiclau Jul 23, 2019
acb5855
fix contact
loiclau Jul 23, 2019
7644287
fix contact template
loiclau Jul 23, 2019
5a171b8
fix contact group
loiclau Jul 23, 2019
f4c68e5
fix escalation
loiclau Jul 24, 2019
2fcc4c5
fix host cat
loiclau Jul 24, 2019
7448cc0
fix host dependency
loiclau Jul 24, 2019
e8f1613
fix host template
loiclau Jul 24, 2019
0bd555f
fix hostgroup
loiclau Jul 24, 2019
8eb583f
fix host group dependency
loiclau Jul 24, 2019
eff3b25
fix meta
loiclau Jul 24, 2019
ba7aedc
fix meta dependency
loiclau Jul 24, 2019
efa977b
fix service by hg button
loiclau Jul 24, 2019
8f17f64
fix services categories
loiclau Jul 24, 2019
9fbe3e6
fix service dependency
loiclau Jul 24, 2019
88b622a
fix service template
loiclau Jul 24, 2019
5f9514a
fix service group
loiclau Jul 24, 2019
d761189
fix service group dependency
loiclau Jul 24, 2019
4b2b276
fix timeperiod
loiclau Jul 24, 2019
4ba5152
fix traps
loiclau Jul 24, 2019
8f9479c
fix trap group
loiclau Jul 24, 2019
30f5459
fix trap manufacturer
loiclau Jul 24, 2019
48cf539
fix comment
loiclau Jul 24, 2019
9a8221f
fix downtime
loiclau Jul 24, 2019
155db0e
fix recurrent downtime
loiclau Jul 24, 2019
b556e64
fix graph template
loiclau Jul 24, 2019
15376af
fix curves
loiclau Jul 24, 2019
b8b6ff4
fix virtual metrics
loiclau Jul 24, 2019
1dd4699
fix logs
loiclau Jul 24, 2019
a285282
fix ldap
loiclau Jul 24, 2019
250379f
fix performance data
loiclau Jul 24, 2019
7eef046
fix default limit
loiclau Jul 25, 2019
1c6ad3b
add default limit if null
loiclau Jul 25, 2019
e0bfd21
use replaceState
loiclau Jul 25, 2019
03b603f
style
loiclau Jul 25, 2019
98c0959
fix host name save
loiclau Jul 25, 2019
b7662b8
Update www/include/configuration/configObject/service/listServiceByHo…
loiclau Jul 29, 2019
fdd0504
Update www/include/views/componentTemplates/listComponentTemplates.php
loiclau Jul 29, 2019
e6bb09c
fix style
loiclau Jul 29, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion www/include/Administration/configChangelog/viewLogs.ihtml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<td><input type='text' name='searchO' value="{$searchO}" /></td>
<td><input type='text' name='searchU' value="{$searchU}" /></td>
<td><select name='otype'>{$obj_type}</select></td>
<td><input type='submit' class="btc bt_success" name='SearchB' value='{$Search}' /></td>
<td>{$form.SearchB.html}</td>
</tr>
</tbody>
</table>
Expand Down
6 changes: 6 additions & 0 deletions www/include/Administration/configChangelog/viewLogs.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,12 @@ function searchUserName($username)
//Init QuickForm
$form = new HTML_QuickFormCustom('select_form', 'POST', "?p=" . $p);

$attrBtnSuccess = array(
"class" => "btc bt_success",
"onClick" => "window.history.replaceState('', '', '?p=" . $p . "');"
);
$form->addElement('submit', 'SearchB', _("Search"), $attrBtnSuccess);

//Init Smarty
$tpl = initSmartyTpl($path, new Smarty());

Expand Down
2 changes: 1 addition & 1 deletion www/include/Administration/parameters/ldap/list.ihtml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</tr>
<tr>
<td><input type="text" name="searchLdap" value="{$searchLdap}"></td>
<td><input type="submit" value="{t}Search{/t}" class="btc bt_success"></td>
<td>{$form.Search.html}</td>
</tr>
</tbody>
</table>
Expand Down
6 changes: 6 additions & 0 deletions www/include/Administration/parameters/ldap/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@

$form = new HTML_QuickFormCustom('select_form', 'POST', "?o=ldap&p=" . $p);

$attrBtnSuccess = array(
"class" => "btc bt_success",
"onClick" => "window.history.replaceState('', '', '?p=" . $p . "');"
);
$form->addElement('submit', 'Search', _("Search"), $attrBtnSuccess);

$tpl->assign('list', $list);
$tpl->assign(
'msg',
Expand Down
150 changes: 75 additions & 75 deletions www/include/Administration/performance/viewData.ihtml
Original file line number Diff line number Diff line change
@@ -1,83 +1,83 @@
<script type="text/javascript" src="./include/common/javascript/tool.js"></script>
<form name='form' method='POST'>
<input name="o" type="hidden">
<table class="ajaxOption table">
<tbody>
<input name="o" type="hidden">
<table class="ajaxOption table">
<tbody>
<tr>
<th><h5>{t}Filters{/t}</h5></th>
<th><h5>{t}Filters{/t}</h5></th>
</tr>
<tr>
<tr>
<td><h4>{$Hosts}</h4></td>
<td><h4>{$Services}</h4></td>
<td><h4>{$Pollers}</h4></td>
</tr>
<td><h4>{$Services}</h4></td>
<td><h4>{$Pollers}</h4></td>
</tr>
<tr>
<td><input type='text' name='searchH' value="{$searchH}" /></td>
<td><input type='text' name='searchS' value="{$searchS}" /></td>
<td>
<select name="searchP">
<option value=""></option>
{foreach from=$instances key=instanceId item=instanceName}
<option value="{$instanceId}"{if $instanceId == $searchP} selected{/if}>{$instanceName}</option>
{/foreach}
</select>
</td>
<td><input type='submit' name='Search' value='{$Search}' class="btc bt_success" /></td>
<td><input type='text' name='searchH' value="{$searchH}"/></td>
<td><input type='text' name='searchS' value="{$searchS}"/></td>
<td>
<select name="searchP">
<option value=""></option>
{foreach from=$instances key=instanceId item=instanceName}
<option value="{$instanceId}" {if $instanceId== $searchP} selected{
/if}>{$instanceName}</option>
{/foreach}
</select>
</td>
<td>{$form.Search.html}</td>
</tr>
</tbody>
</table>
<table class="ToolbarTable table">
<tr class="ToolbarTR">
<td>
{$msg.options} {$form.o1.html}
&nbsp;&nbsp;&nbsp;
</td>
<input name="p" value="{$p}" type="hidden">
{php}
include('./include/common/pagination.php');
{/php}
</tr>
</table>
<table class="ListTable">
<tr class="ListHeader">
<td class="ListColHeaderPicker"><input type="checkbox" name="checkall" onclick="checkUncheckAll(this);"/>
</td>
<td class="ListColLeft">{$Host}</td>
<td class="ListColCenter">{$Service}</td>
<td class="ListColCenter">{$Metrics}</td>
<td class="ListColCenter">{$RebuildWaiting}</td>
<td class="ListColCenter">{$Delete}</td>
<td class="ListColCenter">{$Hidden}</td>
<td class="ListColCenter">{$Locked}</td>
</tr>
{assign var='host_name' value=''}
{foreach item=d from=$data}
<tr class="{$d.class}">
<td class="ListColCenter"><input name="select[{$d.id}]" value="1" type="checkbox"></td>
<td class="ListColLeft">{if !$host_name || $host_name != $d.host_name}{$d.host_name}{/if}</td>
<td class="ListColLeft">{$d.service_description}</td>
<td class="ListColCenter">{$d.metrics_name}</td>
<td class="ListColCenter">{$d.must_be_rebuild}</td>
<td class="ListColCenter">{$d.to_delete}</td>
<td class="ListColCenter">{$d.hidden}</td>
<td class="ListColCenter">{$d.locked}</td>
</tr>
{assign var='host_name' value=$d.host_name}
{/foreach}
</table>
<table class="ToolbarTable table">
<tr class="ToolbarTR">
<td>
{$msg.options} {$form.o2.html}
&nbsp;&nbsp;&nbsp;
</td>
<input name="p" value="{$p}" type="hidden">
{php}
include('./include/common/pagination.php');
{/php}
</tr>
</tbody>
</table>
<table class="ToolbarTable table">
<tr class="ToolbarTR">
<td>
{$msg.options} {$form.o1.html}
&nbsp;&nbsp;&nbsp;
<!-- <a href="{$msg.addL}" class="btc bt_success">{$msg.addT}</a> -->
</td>
<input name="p" value="{$p}" type="hidden">
{php}
include('./include/common/pagination.php');
{/php}
</tr>
</table>
<table class="ListTable">
<tr class="ListHeader">
<td class="ListColHeaderPicker"><input type="checkbox" name="checkall" onclick="checkUncheckAll(this);"/></td>
<td class="ListColLeft">{$Host}</td>
<td class="ListColCenter">{$Service}</td>
<td class="ListColCenter">{$Metrics}</td>
<td class="ListColCenter">{$RebuildWaiting}</td>
<td class="ListColCenter">{$Delete}</td>
<td class="ListColCenter">{$Hidden}</td>
<td class="ListColCenter">{$Locked}</td>
</tr>
{assign var='host_name' value=''}
{foreach item=d from=$data}
<tr class="{$d.class}">
<td class="ListColCenter"><input name="select[{$d.id}]" value="1" type="checkbox"></td>
<td class="ListColLeft">{if !$host_name || $host_name != $d.host_name}{$d.host_name}{/if}</td>
<td class="ListColLeft">{$d.service_description}</td>
<td class="ListColCenter">{$d.metrics_name}</td>
<td class="ListColCenter">{$d.must_be_rebuild}</td>
<td class="ListColCenter">{$d.to_delete}</td>
<td class="ListColCenter">{$d.hidden}</td>
<td class="ListColCenter">{$d.locked}</td>
</tr>
{assign var='host_name' value=$d.host_name}
{/foreach}
</table>
<table class="ToolbarTable table">
<tr class="ToolbarTR">
<td>
{$msg.options} {$form.o2.html}
&nbsp;&nbsp;&nbsp;
<!-- <a href="{$msg.addL}" class="btc bt_success">{$msg.addT}</a> -->
</td>
<input name="p" value="{$p}" type="hidden">
{php}
include('./include/common/pagination.php');
{/php}
</tr>
</table>
<input type='hidden' id='limit' name='limit' value='{$limit}'>
{$form.hidden}
</table>
<input type='hidden' id='limit' name='limit' value='{$limit}'>
{$form.hidden}
</form>
7 changes: 7 additions & 0 deletions www/include/Administration/performance/viewData.php
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,13 @@

$form = new HTML_QuickFormCustom('form', 'POST', "?p=" . $p);

$attrBtnSuccess = array(
"class" => "btc bt_success",
"onClick" => "window.history.replaceState('', '', '?p=" . $p . "');"
);
$form->addElement('submit', 'Search', _("Search"), $attrBtnSuccess);


?>
<script type="text/javascript">
function setO(_i) {
Expand Down
13 changes: 8 additions & 5 deletions www/include/common/autoNumLimit.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,22 @@
} else {
if (($p >= 200 && $p < 300) || ($p >= 20000 && $p < 30000)) {
$dbResult = $pearDB->query("SELECT * FROM `options` WHERE `key` = 'maxViewMonitoring'");
$gopt = $dbResult->fetch();
$limit = myDecode($gopt['value']);
} else {
$dbResult = $pearDB->query("SELECT * FROM `options` WHERE `key` = 'maxViewConfiguration'");
$gopt = $dbResult->fetch();
$limit = myDecode($gopt['value']);
}
$gopt = $dbResult->fetch();
if ((int)$gopt['value']) {
$limit = (int)$gopt['value'];
} else {
$limit = 30;
}
}

$_SESSION[$sessionLimitKey] = $limit;

// Setting the pagination filter
if (isset($_POST['num']) && isset($_POST['search'])
if (isset($_POST['num'])
&& isset($_POST['search'])
|| (isset($centreon->historyLastUrl) && $centreon->historyLastUrl !== $url)
) {
// Checking if the current page and the last displayed page are the same and resetting the filters
Expand Down
39 changes: 19 additions & 20 deletions www/include/common/pagination.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@
global $num, $limit, $search, $url, $pearDB, $search_type_service, $search_type_host,
$host_name, $hostgroup, $rows, $p, $gopt, $pagination, $poller, $template, $search_output, $search_service;

$type = $_REQUEST["type"] ?? null;
$type = filter_var(
$_POST['type'] ?? $_GET['type'] ?? null,
FILTER_VALIDATE_INT
);
$type = $type ? '&type=' . $type : '';
$o = $_GET["o"] ?? null;

//saving current pagination filter value and current displayed page
Expand Down Expand Up @@ -175,8 +179,7 @@

if ($rows != 0) {
for ($i = $iStart; $i <= $iEnd; $i++) {
$urlPage = "main.php?p=" . $p . "&num=" . $i . "&limit=" . $limit . "&poller=" . $poller .
"&template=" . $template . "&search=" . $search . "&type=" . $type . "&o=" . $o . $url_var;
$urlPage = "main.php?p=" . $p . "&num=" . $i . $type;
$pageArr[$i] = array(
"url_page" => $urlPage,
"label_page" => "<b>" . ($i + 1) . "</b>",
Expand All @@ -197,16 +200,14 @@
if (($prev = $num - 1) >= 0) {
$tpl->assign(
'pagePrev',
("main.php?p=" . $p . "&num=" . $prev . "&limit=" . $limit . "&poller=" . $poller .
"&template=" . $template . "&search=" . $search . "&type=" . $type . "&o=" . $o . $url_var)
("main.php?p=" . $p . "&num=" . $prev . "&limit=" . $limit . $type)
);
}

if (($next = $num + 1) < ($rows / $limit)) {
$tpl->assign(
'pageNext',
("main.php?p=" . $p . "&num=" . $next . "&limit=" . $limit . "&poller=" . $poller .
"&template=" . $template . "&search=" . $search . "&type=" . $type . "&o=" . $o . $url_var)
("main.php?p=" . $p . "&num=" . $next . "&limit=" . $limit . $type)
);
}

Expand All @@ -220,16 +221,13 @@
if ($page_max > 5 && $num != 0) {
$tpl->assign(
'firstPage',
("main.php?p=" . $p . "&num=0&limit=" . $limit . "&poller=" . $poller .
"&template=" . $template . "&search=" . $search . "&type=" . $type . "&o=" . $o . $url_var)
("main.php?p=" . $p . "&num=0&limit=" . $limit . $type)
);
}
if ($page_max > 5 && $num != ($pageNumber - 1)) {
$tpl->assign(
'lastPage',
("main.php?p=" . $p . "&num=" . ($pageNumber - 1) . "&limit=" . $limit .
"&template=" . $template . "&poller=" . $poller . "&search=" . $search .
"&type=" . $type . "&o=" . $o . $url_var)
("main.php?p=" . $p . "&num=" . ($pageNumber - 1) . "&limit=" . $limit . $type)
);
}

Expand All @@ -251,14 +249,15 @@
}

?>
<script type="text/javascript">
function setL(_this) {
var _l = document.getElementsByName('l');
document.forms['form'].elements['limit'].value = _this;
_l[0].value = _this;
_l[1].value = _this;
}
</script>
<script type="text/javascript">
function setL(_this) {
var _l = document.getElementsByName('l');
document.forms['form'].elements['limit'].value = _this;
_l[0].value = _this;
_l[1].value = _this;
window.history.replaceState('', '', '?p=<?= $p.$type ?>');
}
</script>
<?php
$form = new HTML_QuickFormCustom(
'select_form',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</tr>
<tr>
<td><input type="text" name="searchC" value="{$searchC}"></td>
<td><input type="submit" value="{t}Search{/t}" class="btc bt_success"></td>
<td>{$form.Search.html}</td>
</tr>
</tbody>
</table>
Expand Down
13 changes: 8 additions & 5 deletions www/include/configuration/configObject/command/listCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@
FILTER_SANITIZE_STRING
);

$num = filter_var(
$_POST['num'] ?? $_GET['num'] ?? $centreon->historyPage[$url] ?? 0,
FILTER_VALIDATE_INT
);

$type = filter_var(
$_POST['type'] ?? $_GET['type'] ?? null,
FILTER_VALIDATE_INT
Expand Down Expand Up @@ -81,6 +76,7 @@
$search = $centreon->historySearch[$url]['search' . $type] ?? null;
}


$type_str = $type ? " AND `command_type` = " . $type : "";
$search = tidySearchKey($search, $advanced_search);

Expand Down Expand Up @@ -126,6 +122,13 @@
// Different style between each lines
$style = "one";

$addrType = $type ? "&type=" . $type : "";
$attrBtnSuccess = array(
"class" => "btc bt_success",
"onClick" => "window.history.replaceState('', '', '?p=" . $p . $addrType. "');"
);
$form->addElement('submit', 'Search', _("Search"), $attrBtnSuccess);

// Define command Type table
$commandType = array(
"1" => _("Notification"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
<td><h4>{t}Contact{/t}</h4></td>
</tr>
<tr>
<td><input type="text" name="searchC" value="{$searchC}"></td>
<td><input type="submit" value="{t}Search{/t}" class="btc bt_success"></td>
<td><input type="text" name="searchC" value="{$searchC}"></td>
<td>{$form.Search.html}</td>
</tr>
</tbody>
</table>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,13 @@

// Different style between each lines
$style = "one";

$attrBtnSuccess = array(
"class" => "btc bt_success",
"onClick" => "window.history.replaceState('', '', '?p=" . $p . "');"
);
$form->addElement('submit', 'Search', _("Search"), $attrBtnSuccess);

$contactTypeIcone = array(
1 => "./img/icons/admin.png",
2 => "./img/icons/user.png",
Expand Down
Loading