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

Commit

Permalink
fix(ui): saving configuration > commands filters (#7369)
Browse files Browse the repository at this point in the history
* fix(ui): saving configuration > commands checks filter
* fix(ui): replace the lastPage array with a string for the pagination filters
* fix(ui): saving configuration > other command pages filters
  • Loading branch information
sc979 committed Apr 3, 2019
1 parent 5621cf0 commit 0746605
Show file tree
Hide file tree
Showing 5 changed files with 159 additions and 125 deletions.
11 changes: 4 additions & 7 deletions www/include/common/pagination.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,8 @@
$type = $_REQUEST["type"] ?? null;
$o = $_GET["o"] ?? $o = null;

// splitting the path ($url) to keep only the current page's filename
$currentPage = (explode('/', $url));

if (isset($centreon->historyLastPage) && $centreon->historyLastPage !== $currentPage) {
// checking if the current page and the last displayed page are the same
if (isset($centreon->historyLastPage) && $centreon->historyLastPage !== $url) {
$num = 0;
} elseif (isset($_REQUEST['num'])) {
$num = filter_var(
Expand All @@ -59,10 +57,9 @@
$num = $centreon->historyPage[$url] ?? 0;
}

//saving current pagination filter value
//saving current pagination filter value and current displayed page
$centreon->historyPage[$url] = $num;
//saving current page's file name
$centreon->historyLastPage = $currentPage;
$centreon->historyLastPage = $url;

$num = addslashes($num);

Expand Down
4 changes: 2 additions & 2 deletions www/include/configuration/configObject/command/command.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/*
* Copyright 2005-2015 Centreon
* Centreon is developped by : Julien Mathis and Romain Le Merlus under
* Copyright 2005-2019 Centreon
* Centreon is developed by : Julien Mathis and Romain Le Merlus under
* GPL Licence 2.0.
*
* This program is free software; you can redistribute it and/or modify it under
Expand Down
75 changes: 42 additions & 33 deletions www/include/configuration/configObject/command/listCommand.ihtml
Original file line number Diff line number Diff line change
@@ -1,43 +1,45 @@
<script type="text/javascript" src="./include/common/javascript/tool.js"></script>
<form name='form' method='POST'>
<table class="ajaxOption table">
<tbody>
<tr>
<th><h5>{t}Filters{/t}</h5></th>
</tr>
<tr>
<td><h4>{t}Command{/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>
</tr>
</tbody>
</table>
<table class="ajaxOption table">
<tbody>
<tr>
<th><h5>{t}Filters{/t}</h5></th>
</tr>
<tr>
<td><h4>{t}Command{/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>
</tr>
</tbody>
</table>
<table class="ToolbarTable table">
<tr class="ToolbarTR">
{if $mode_access=='w'}
<td>
{$msg.options}{$form.o1.html}&nbsp;&nbsp;&nbsp;<a href="{$msg.addL}" class="btc bt_success">{$msg.addT}</a>
</td>
<td>
{$msg.options}{$form.o1.html}&nbsp;&nbsp;&nbsp;<a href="{$msg.addL}" class="btc bt_success">{$msg.addT}</a>
</td>
{else}
<td>&nbsp;</td>
<td>&nbsp;</td>
{/if}
<input name="p" value="{$p}" type="hidden">
{php}
include('./include/common/pagination.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="ListColHeaderPicker">
<input type="checkbox" name="checkall" onclick="checkUncheckAll(this);"/>
</td>
<td class="ListColHeaderLeft">{$headerMenu_name}</td>
<td class="ListColHeaderLeft">{$headerMenu_desc}</td>
<td class="ListColHeaderCenter">{$headerMenu_type}</td>
{if $type == 2}
<td class="ListColHeaderCenter">{$headerMenu_huse}</td>
<td class="ListColHeaderCenter">{$headerMenu_suse}</td>
<td class="ListColHeaderCenter">{$headerMenu_huse}</td>
<td class="ListColHeaderCenter">{$headerMenu_suse}</td>
{/if}
<td class="ListColHeaderCenter">{t}Status{/t}</td>
<td class="ListColHeaderRight">{$headerMenu_options}</td>
Expand Down Expand Up @@ -65,30 +67,37 @@
<td class="ListColLeft"><a href="{$elemArr[elem].RowMenu_link}">{$elemArr[elem].RowMenu_desc}</a></td>
<td class="ListColCenter">{$elemArr[elem].RowMenu_type}</td>
{if $type == 2}
<td class="ListColCenter">{$elemArr[elem].RowMenu_huse}</td>
<td class="ListColCenter">{$elemArr[elem].RowMenu_suse}</td>
<td class="ListColCenter">{$elemArr[elem].RowMenu_huse}</td>
<td class="ListColCenter">{$elemArr[elem].RowMenu_suse}</td>
{/if}
<td class="ListColCenter"><span class="badge {$elemArr[elem].RowMenu_badge}">{$elemArr[elem].RowMenu_status}</span></td>
<td class="ListColRight" align="right">{if $mode_access == 'w'}{$elemArr[elem].RowMenu_options}{else}&nbsp;{/if}</td>
<td class="ListColCenter">
<span class="badge {$elemArr[elem].RowMenu_badge}">{$elemArr[elem].RowMenu_status}</span>
</td>
<td class="ListColRight" align="right">
{if $mode_access == 'w'}
{$elemArr[elem].RowMenu_options}
{else}&nbsp;
{/if}
</td>
</tr>
{/section}
</table>
<table class="ToolbarTable table">
<tr class="ToolbarTR">
{if $mode_access == 'w'}
<td>
{$msg.options}{$form.o2.html}&nbsp;&nbsp;&nbsp;<a href="{$msg.addL}" class="btc bt_success">{$msg.addT}</a>
</td>
<td>
{$msg.options}{$form.o2.html}&nbsp;&nbsp;&nbsp;<a href="{$msg.addL}" class="btc bt_success">{$msg.addT}</a>
</td>
{else}
<td>&nbsp;</td>
<td>&nbsp;</td>
{/if}
<input name="p" value="{$p}" type="hidden">
{php}
include('./include/common/pagination.php');
include('./include/common/pagination.php');
{/php}
</tr>
</table>
<input type='hidden' name='o' id='o' value='42'>
<input type='hidden' id='limit' name='limit' value='{$limit}'>
{$form.hidden}
<input type='hidden' id='limit' name='limit' value='{$limit}'>
{$form.hidden}
</form>
Loading

0 comments on commit 0746605

Please sign in to comment.