From 1708e535a6cd4eda6fd2c5e0a28970b91fb8b926 Mon Sep 17 00:00:00 2001 From: Cameron Date: Mon, 13 Apr 2015 00:55:50 -0700 Subject: [PATCH] Added button to enter current IP while whitelisting. --- e107_admin/banlist.php | 23 ++++++++++++++++++++++- e107_handlers/form_handler.php | 11 ++++++++--- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/e107_admin/banlist.php b/e107_admin/banlist.php index 20c333d9c..9885593a0 100644 --- a/e107_admin/banlist.php +++ b/e107_admin/banlist.php @@ -44,6 +44,19 @@ require_once(e_HANDLER.'iphandler_class.php'); // This is probably already load include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_'.e_PAGE); +e107::js('footer-inline', " + + $('#useip').click(function (event) { + + var id = $(this).attr('data-ip'); + $('#banlist-ip').val(id); + event.preventDefault(); + }); + + +"); + + class banlist_admin extends e_admin_dispatcher { @@ -149,6 +162,14 @@ class banlist_ui extends e_admin_ui } + if($this->getAction() == 'create') + { + $myip = e107::getIPHandler()->getIP(true); + $this->fields['banlist_ip']['writeParms']['rightCellClass'] = 'form-inline'; + $this->fields['banlist_ip']['writeParms']['pre'] = "
"; + $this->fields['banlist_ip']['writeParms']['post'] = "
"; // USERIP; + } + } @@ -390,7 +411,7 @@ class banlist_form_ui extends e_admin_form_ui } elseif($this->getController()->getAction() == 'create') { - return $this->hidden('banlist_bantype',eIPHandler::BAN_TYPE_MANUAL)."Blacklist entry"; //TODO LAN + return $this->hidden('banlist_bantype',eIPHandler::BAN_TYPE_MANUAL)."Blacklist entry"; //TODO LAN } diff --git a/e107_handlers/form_handler.php b/e107_handlers/form_handler.php index 4d501b7e2..02ffe3c62 100644 --- a/e107_handlers/form_handler.php +++ b/e107_handlers/form_handler.php @@ -3692,7 +3692,7 @@ class e_form break; case 'ip': - $ret = $this->text($key, e107::getIPHandler()->ipDecode($value), 32, $parms); + $ret = vartrue($parms['pre']).$this->text($key, e107::getIPHandler()->ipDecode($value), 32, $parms).vartrue($parms['post']); break; case 'email': @@ -4435,12 +4435,17 @@ class e_form } else { + + $leftCellClass = (!empty($writeParms['leftCellClass'])) ? " class='".$writeParms['leftCellClass']."'" : ""; + $rightCellClass = (!empty($writeParms['rightCellClass'])) ? " class='".$writeParms['rightCellClass']."'" : ""; + + $text .= " - + ".$leftCell." - + ".$rightCell."