mirror of
https://github.com/pfsense/pfsense.git
synced 2025-10-26 11:38:35 +00:00
Make consistent rule information section
(cherry picked from commitf0dc8b688c) (cherry picked from commit4c4504b1e7)
This commit is contained in:
parent
f4f220a796
commit
1ea6736f8f
@ -418,6 +418,47 @@ function gen_requirestatefilter_field(&$section, $value) {
|
||||
'before the states are displayed. Useful for systems with large state tables.');
|
||||
}
|
||||
|
||||
/****f* pfsense-utils/gen_created_updated_fields
|
||||
* NAME
|
||||
* gen_created_updated_fields
|
||||
* INPUTS
|
||||
* Pointer to form object
|
||||
* Array of created time and username
|
||||
* Array of updated time and username
|
||||
* RESULT
|
||||
* no return value, section object is added to form if needed
|
||||
******/
|
||||
function gen_created_updated_fields(&$form, $created, $updated) {
|
||||
$has_created_time = (isset($created['time']) && isset($created['username']));
|
||||
$has_updated_time = (isset($updated['time']) && isset($updated['username']));
|
||||
|
||||
if ($has_created_time || $has_updated_time) {
|
||||
$section = new Form_Section('Rule Information');
|
||||
|
||||
if ($has_created_time) {
|
||||
$section->addInput(new Form_StaticText(
|
||||
'Created',
|
||||
sprintf(
|
||||
gettext('%1$s by %2$s'),
|
||||
date(gettext("n/j/y H:i:s"), $created['time']),
|
||||
$created['username'])
|
||||
));
|
||||
}
|
||||
|
||||
if ($has_updated_time) {
|
||||
$section->addInput(new Form_StaticText(
|
||||
'Updated',
|
||||
sprintf(
|
||||
gettext('%1$s by %2$s'),
|
||||
date(gettext("n/j/y H:i:s"), $updated['time']),
|
||||
$updated['username'])
|
||||
));
|
||||
}
|
||||
|
||||
$form->add($section);
|
||||
}
|
||||
}
|
||||
|
||||
function hardware_offloading_applyflags($iface) {
|
||||
global $config;
|
||||
|
||||
|
||||
@ -990,28 +990,7 @@ if (isset($id) && $a_nat[$id] && (!isset($_GET['dup']) || !is_numericint($_GET['
|
||||
|
||||
$form->add($section);
|
||||
|
||||
$has_created_time = (isset($a_nat[$id]['created']) && is_array($a_nat[$id]['created']));
|
||||
$has_updated_time = (isset($a_nat[$id]['updated']) && is_array($a_nat[$id]['updated']));
|
||||
|
||||
if ($has_created_time || $has_updated_time) {
|
||||
$section = new Form_Section('Rule Information');
|
||||
|
||||
if ($has_created_time) {
|
||||
$section->addInput(new Form_StaticText(
|
||||
'Created',
|
||||
date(gettext("n/j/y H:i:s"), $a_nat[$id]['created']['time']) . gettext(" by ") . $a_nat[$id]['created']['username']
|
||||
));
|
||||
}
|
||||
|
||||
if ($has_updated_time) {
|
||||
$section->addInput(new Form_StaticText(
|
||||
'Updated',
|
||||
date(gettext("n/j/y H:i:s"), $a_nat[$id]['updated']['time']) . gettext(" by ") . $a_nat[$id]['updated']['username']
|
||||
));
|
||||
}
|
||||
|
||||
$form->add($section);
|
||||
}
|
||||
gen_created_updated_fields($form, $a_nat[$id]['created'], $a_nat[$id]['updated']);
|
||||
|
||||
if (isset($id) && $a_nat[$id]) {
|
||||
$form->addGlobal(new Form_Input(
|
||||
|
||||
@ -686,28 +686,7 @@ $section->addInput(new Form_Input(
|
||||
|
||||
$form->add($section);
|
||||
|
||||
$has_created_time = (isset($a_out[$id]['created']) && is_array($a_out[$id]['created']));
|
||||
$has_updated_time = (isset($a_out[$id]['updated']) && is_array($a_out[$id]['updated']));
|
||||
|
||||
if ($has_created_time || $has_updated_time) {
|
||||
$section = new Form_Section('Rule Information');
|
||||
|
||||
if ($has_created_time) {
|
||||
$section->addInput(new Form_StaticText(
|
||||
'Created',
|
||||
date(gettext("n/j/y H:i:s"), $a_out[$id]['created']['time']) . gettext(" by ") . $a_out[$id]['created']['username']
|
||||
));
|
||||
}
|
||||
|
||||
if ($has_updated_time) {
|
||||
$section->addInput(new Form_StaticText(
|
||||
'Updated',
|
||||
date(gettext("n/j/y H:i:s"), $a_out[$id]['updated']['time']) . gettext(" by ") . $a_out[$id]['updated']['username']
|
||||
));
|
||||
}
|
||||
|
||||
$form->add($section);
|
||||
}
|
||||
gen_created_updated_fields($form, $a_out[$id]['created'], $a_out[$id]['updated']);
|
||||
|
||||
print($form);
|
||||
|
||||
|
||||
@ -1768,30 +1768,10 @@ $section->add($group)->setHelp('Choose the Acknowledge Queue only if there is a
|
||||
'selected Queue.'
|
||||
);
|
||||
|
||||
$has_created_time = (isset($a_filter[$id]['created']) && is_array($a_filter[$id]['created']));
|
||||
$has_updated_time = (isset($a_filter[$id]['updated']) && is_array($a_filter[$id]['updated']));
|
||||
|
||||
|
||||
if ($has_created_time || $has_updated_time) {
|
||||
$form->add($section);
|
||||
$section = new Form_Section('Rule Information');
|
||||
|
||||
if ($has_created_time) {
|
||||
$section->addInput(new Form_StaticText(
|
||||
'Created',
|
||||
date('n/j/y H:i:s', $a_filter[$id]['created']['time']) . gettext(' by ') .'<b>'. $a_filter[$id]['created']['username'] .'</b>'
|
||||
));
|
||||
}
|
||||
|
||||
if ($has_updated_time) {
|
||||
$section->addInput(new Form_StaticText(
|
||||
'Updated',
|
||||
date('n/j/y H:i:s', $a_filter[$id]['updated']['time']) . gettext(' by ') .'<b>'. $a_filter[$id]['updated']['username'] .'</b>'
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
$form->add($section);
|
||||
|
||||
gen_created_updated_fields($form, $a_filter[$id]['created'], $a_filter[$id]['updated']);
|
||||
|
||||
echo $form;
|
||||
?>
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user