summaryrefslogtreecommitdiffstats
path: root/src/usr/local/www
diff options
context:
space:
mode:
authorStephen Beaver <sbeaver@netgate.com>2015-11-09 12:19:46 -0500
committerStephen Beaver <sbeaver@netgate.com>2015-11-09 12:20:26 -0500
commit9279147ad26f3c2d32b7e37da010f2346e77a6e7 (patch)
treee895a6fbf45424d8c57296e89dc6dbb7fdc5762e /src/usr/local/www
parent3c986c5d90f88d4c20cce1ae58994d5932f415df (diff)
downloadpfsense-9279147ad26f3c2d32b7e37da010f2346e77a6e7.zip
pfsense-9279147ad26f3c2d32b7e37da010f2346e77a6e7.tar.gz
Allow fa icons to be embedded in Form_Button class buttons
Diffstat (limited to 'src/usr/local/www')
-rw-r--r--src/usr/local/www/classes/Form/Button.class.php12
-rw-r--r--src/usr/local/www/classes/Form/Element.class.php19
-rwxr-xr-xsrc/usr/local/www/diag_logs.php26
3 files changed, 48 insertions, 9 deletions
diff --git a/src/usr/local/www/classes/Form/Button.class.php b/src/usr/local/www/classes/Form/Button.class.php
index 32876a7..0b2a9de 100644
--- a/src/usr/local/www/classes/Form/Button.class.php
+++ b/src/usr/local/www/classes/Form/Button.class.php
@@ -36,7 +36,7 @@ class Form_Button extends Form_Input
'type' => 'submit',
);
- public function __construct($name, $title, $link = null)
+ public function __construct($name, $title, $link = null, $icon = null)
{
// If we have a link; we're actually an <a class='btn'>
if (isset($link))
@@ -45,6 +45,16 @@ class Form_Button extends Form_Input
$this->_tagName = 'a';
$this->addClass('btn-default');
unset($this->_attributes['type']);
+ if(isset($icon)) {
+ $this->_attributes['icon'] = $icon;
+ }
+ }
+ else if(isset($icon))
+ {
+ $this->_tagSelfClosing = false;
+ $this->_tagName = 'button';
+ $this->_attributes['value'] = $title;
+ $this->_attributes['icon'] = $icon;
}
else
{
diff --git a/src/usr/local/www/classes/Form/Element.class.php b/src/usr/local/www/classes/Form/Element.class.php
index d3ad142..163c14b 100644
--- a/src/usr/local/www/classes/Form/Element.class.php
+++ b/src/usr/local/www/classes/Form/Element.class.php
@@ -61,7 +61,7 @@ class Form_Element
$this->_attributes[ $key ] = $value;
return $this;
}
-
+
public function __toString()
{
$attributes = '';
@@ -79,12 +79,27 @@ class Form_Element
if ($value === null)
continue;
+ if ($key == "icon")
+ continue;
+
$attributes .= ' '. $key;
if ($value !== true)
$attributes .= '="' . htmlspecialchars($value) . '"';
}
- return '<'. $this->_tagName . $attributes . ($this->_tagSelfClosing ? '/' : '') .'>';
+ if (isset($this->_attributes['icon'])) {
+ $rv = '<'. $this->_tagName . $attributes .'>' .
+ '<i class="fa ' . $this->_attributes['icon'] . ' icon-embed-btn' . '">' . ' </i>' .
+ htmlspecialchars($this->_attributes['value']);
+
+ if ($this->_tagName != 'a') {
+ $rv .= '</' . $this->_tagName . '>';
+ }
+
+ return $rv;
+ } else {
+ return '<'. $this->_tagName . $attributes . ($this->_tagSelfClosing ? '/' : '') .'>';
+ }
}
protected function _setParent(Form_Element $parent)
diff --git a/src/usr/local/www/diag_logs.php b/src/usr/local/www/diag_logs.php
index 372e138..d4fc974 100755
--- a/src/usr/local/www/diag_logs.php
+++ b/src/usr/local/www/diag_logs.php
@@ -139,15 +139,28 @@ $section->addInput(new Form_Input(
['placeholder' => 'Filter text']
));
-$form->addGlobal(new Form_Button(
+$btnsubmit = new Form_Button(
'filtersubmit',
- 'Filter'
-))->removeClass('btn-primary')->addClass('btn-default')->addClass('btn-sm');
+ 'Filter',
+ null,
+ 'fa-filter'
+);
+
+$btnsubmit->removeClass('btn-primary')->addClass('btn-success')->addClass('btn-sm');
-$form->addGlobal(new Form_Button(
+$btnclear = new Form_Button(
'clear',
- 'Clear log'
-))->removeClass('btn-primary')->addClass('btn-danger')->addClass('btn-sm');
+ 'Clear log',
+ null,
+ 'fa-trash'
+);
+
+$btnclear->removeClass('btn-primary')->addClass('btn-danger')->addClass('btn-sm');
+
+$section->addInput(new Form_StaticText(
+ '',
+ $btnsubmit . $btnclear
+));
$form->add($section);
print $form;
@@ -156,6 +169,7 @@ if ($logfile == 'dhcpd')
print_info_box('Warning: Clearing the log file will restart the DHCP daemon.');
?>
+
<div class="panel panel-default">
<div class="panel-heading"><h2 class="panel-title"><?=gettext("Last ")?><?=$nentries?> <?=$logfile?><?=gettext(" log entries")?></h2></div>
<pre>
OpenPOWER on IntegriCloud