From 214509e2c750eeac082b64563e65ba8b3a399767 Mon Sep 17 00:00:00 2001 From: steve-lad <72376554+steve-lad@users.noreply.github.com> Date: Thu, 10 Jun 2021 12:15:18 +0200 Subject: [PATCH] Use BMO Hooks Use BMO Hooks Correct HTML --- sccpManTraits/bmoFunctions.php | 57 ++++++++++++++++++++++++++++++-- views/advserver.dialtemplate.php | 6 ++-- views/advserver.keyset.php | 22 ++++++------ views/advserver.model.php | 2 +- views/hardware.extension.php | 12 +++---- views/hardware.phone.php | 4 +-- views/hardware.sphone.php | 18 +++++----- 7 files changed, 86 insertions(+), 35 deletions(-) diff --git a/sccpManTraits/bmoFunctions.php b/sccpManTraits/bmoFunctions.php index 9d54576..9bbd35e 100644 --- a/sccpManTraits/bmoFunctions.php +++ b/sccpManTraits/bmoFunctions.php @@ -3,12 +3,41 @@ namespace FreePBX\modules\Sccp_manager\sccpManTraits; trait bmoFunctions { - /* unused but FPBX API requires it */ + + //Need to reload freePBX for modifications below to work + + //need to catch extensions + public static function myConfigPageInits() { + dbug('have config page inits'); + return array("extensions"); + } public function doConfigPageInit($page) { + if ($page == "extensions") { + dbug('have extensions in doConfigPageInit'); + } $this->doGeneralPost(); } + // Try to change extensions which is part of core + public static function myGuiHooks() { + return array('core'); + } + + public function doGuiHook(&$cc) { + dbug('$_REQUEST', $_REQUEST); + //dbug('CC', $cc); + if ($_REQUEST['display'] == "extensions" ) { + if (isset($_REQUEST['tech_hardware'])) { + dbug('Have caught hook in doGuiHook'); + $this->getActionBar($_REQUEST); + } + //$cc->addguielem("_top", new \gui_pageheading('', 'I added a header', false)); + } + } + + + /* unused but FPBX API requires it */ public function install() { @@ -85,7 +114,6 @@ trait bmoFunctions { 'value' => _("Cancel") ), ); - break; case 'sccpsettings': $buttons = array( @@ -101,7 +129,30 @@ trait bmoFunctions { 'value' => _("Cancel") ), ); - + break; + case 'extensions': + // only called from configpage inits + $buttons = array( + 'submit' => array( + 'name' => 'ajaxsubmit', + 'id' => 'ajaxsubmit', + 'data-search' => '?display=sccp_custom', + 'value' => _("Save") + ), + 'Save' => array( + 'name' => 'ajaxsubmit2', + 'id' => 'ajaxsubmit2', + 'stayonpage' => 'yes', + 'value' => _("Save + Continue") + ), + 'cancel' => array( + 'name' => 'cancel', + 'id' => 'ajaxcancel', + 'data-search' => '?display=sccp_custom', + 'data-hash' => 'sccpdevice', + 'value' => _("Cancel") + ), + ); break; } return $buttons; diff --git a/views/advserver.dialtemplate.php b/views/advserver.dialtemplate.php index cc37ab7..e7bd7bf 100644 --- a/views/advserver.dialtemplate.php +++ b/views/advserver.dialtemplate.php @@ -12,12 +12,12 @@