diff options
author | James Bottomley <JBottomley@Parallels.com> | 2013-04-28 00:20:23 -0700 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2013-04-28 00:20:23 -0700 |
commit | 3e415efba84bcea8c3d568d55b597bea12e4731a (patch) | |
tree | 71bb8c18e6f8510dd3066afcd96c35a869d28730 | |
parent | 585d9be17db4e7711cf95146b663b6338df68b29 (diff) | |
download | asterisk-aastra-3e415efba84bcea8c3d568d55b597bea12e4731a.tar.gz |
Blacklist: refactor some code and add a description edit capability
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
-rw-r--r-- | include/Blacklist.class.php | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/include/Blacklist.class.php b/include/Blacklist.class.php index 97114d1..9fd76ec 100644 --- a/include/Blacklist.class.php +++ b/include/Blacklist.class.php @@ -27,19 +27,23 @@ class Blacklist extends BaseAastra { $this->__initvar(); } - function del_black() { + function del_entry($list) { $this->back = $this->url; if (isset($_GET['yesno'])) { if ($_GET['yesno'] == 'yes') { - $this->asm->database_del('blacklist',$this->lastnumber); + $this->asm->database_del($list, $this->lastnumber); } return; } $this->displayObject(new AastraIPPhoneTextScreen()); - $this->do->SetText('Are you sure you want to remove '.$this->lastnumber.' from the Blacklist?'); + $this->do->SetText('Are you sure you want to remove '.$this->lastnumber.' from the '.$list.'?'); $this->yesno(); } + function del_black() { + $this->del_entry('blacklist'); + } + function black() { $this->back = $this->url; if (isset($_GET['yesno'])) { @@ -70,16 +74,7 @@ class Blacklist extends BaseAastra { } function del_white() { - $this->back = $this->url; - if (isset($_GET['yesno'])) { - if ($_GET['yesno'] == 'yes') { - $this->asm->database_del('whitelist',$this->lastnumber); - } - return; - } - $this->displayObject(new AastraIPPhoneTextScreen()); - $this->do->SetText('Are you sure you want to remove '.$this->lastnumber.' "'.$this->whitelist.'" from the Whitelist?'); - $this->yesno(); + $this->del_entry('whitelist'); } function white() { @@ -94,6 +89,9 @@ class Blacklist extends BaseAastra { $this->do->setType('string'); $this->do->setPrompt('Enter description for '.$this->lastnumber.':'); $this->do->setURL($this->fullurl); + if (isset($_GET['current'])) { + $this->do->setDefault($_GET['current']); + } } function start() { @@ -108,6 +106,7 @@ class Blacklist extends BaseAastra { if ($this->whitelist) { $text .= ' which is already in the whitelist as "'.$this->whitelist.'"'; $this->do->addSoftkey('2', 'Remove Whitelist', $this->url.'?action=del_white'); + $this->do->addSoftkey('4', 'Edit Whitelist', $this->url.'?action=white¤t='.$this->whitelist); } else { $this->do->addSoftkey('2', 'Whitelist', $this->url.'?action=white'); } |