Use BMO Hooks

Use BMO Hooks
Correct HTML
This commit is contained in:
steve-lad 2021-06-10 12:15:18 +02:00
parent 7f96c121fa
commit 214509e2c7
7 changed files with 86 additions and 35 deletions

View file

@ -3,12 +3,41 @@
namespace FreePBX\modules\Sccp_manager\sccpManTraits; namespace FreePBX\modules\Sccp_manager\sccpManTraits;
trait bmoFunctions { 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) { public function doConfigPageInit($page) {
if ($page == "extensions") {
dbug('have extensions in doConfigPageInit');
}
$this->doGeneralPost(); $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 */ /* unused but FPBX API requires it */
public function install() { public function install() {
@ -85,7 +114,6 @@ trait bmoFunctions {
'value' => _("Cancel") 'value' => _("Cancel")
), ),
); );
break; break;
case 'sccpsettings': case 'sccpsettings':
$buttons = array( $buttons = array(
@ -101,7 +129,30 @@ trait bmoFunctions {
'value' => _("Cancel") '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; break;
} }
return $buttons; return $buttons;

View file

@ -12,12 +12,12 @@
<div class="display no-border"> <div class="display no-border">
<h1><?php echo _("Cisco Dial Template") ?></h1> <h1><?php echo _("Cisco Dial Template") ?></h1>
<div id="toolbar-sccp-dialtemplate"> <div id="toolbar-sccp-dialtemplate">
<a class="btn btn-default" href="config.php?display=sccp_adv&amp;tech_hardware=dialplan&amp;extdisplay=*new*"><i class="fa fa-plus">&nbsp;</i><?php echo _("Add Dialplan") ?></a> <a class="btn btn-default" href="config.php?display=sccp_adv&tech_hardware=dialplan&extdisplay=*new*"><i class="fa fa-plus">&nbsp;</i><?php echo _("Add Dialplan") ?></a>
<button id="remove-sccp-dialtemplate" class="btn btn-danger btn-remove" data-type="dialtemplate" data-section="sccp-dialtemplate" disabled> <button id="remove-sccp-dialtemplate" class="btn btn-danger btn-remove" data-type="dialtemplate" data-section="sccp-dialtemplate" disabled>
<i class="glyphicon glyphicon-remove"></i> <span><?php echo _('Delete') ?></span> <i class="glyphicon glyphicon-remove"></i> <span><?php echo _('Delete') ?></span>
</button> </button>
</div> </div>
<table data-cookie="true" data-cookie-id-table="sccp-dialtemplate-table" data-url="ajax.php?module=sccp_manager&amp;command=getDialTemplate" data-cache="false" data-show-refresh="true" data-toolbar="#toolbar-dialtemplate" data-maintain-selected="true" data-show-columns="true" data-show-toggle="true" data-toggle="table" data-pagination="true" data-search="true" class="table table-striped ext-list-sccp" id="table-sccp-dialtemplate" data-id="id"> <table data-cookie="true" data-cookie-id-table="sccp-dialtemplate-table" data-url="ajax.php?module=sccp_manager&command=getDialTemplate" data-cache="false" data-show-refresh="true" data-toolbar="#toolbar-dialtemplate" data-maintain-selected="true" data-show-columns="true" data-show-toggle="true" data-toggle="table" data-pagination="true" data-search="true" class="table table-striped ext-list-sccp" id="table-sccp-dialtemplate" data-id="id">
<thead> <thead>
<tr> <tr>
<!-- <th data-checkbox="true"></th> --> <!-- <th data-checkbox="true"></th> -->

View file

@ -54,7 +54,7 @@ $keynamearray = array('onhook' => array('sname' => 'ONHOOK', 'name' =>'Displa
<div id="toolbar-all"> <div id="toolbar-all">
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" onclick="load_oncliсk(this,'*new*')" data-target=".edit_new_keyset"><i class="fa fa-bolt"></i> <?php echo _("Add Keyset"); ?></button> <button type="button" class="btn btn-primary btn-lg" data-toggle="modal" onclick="load_oncliсk(this,'*new*')" data-target=".edit_new_keyset"><i class="fa fa-bolt"></i> <?php echo _("Add Keyset"); ?></button>
</div> </div>
<table data-cookie="true" data-cookie-id-table="sccp_keyset-all" data-url="ajax.php?module=sccp_manager&amp;command=getSoftKey&amp;type=active" data-cache="false" data-show-refresh="true" data-toolbar="#toolbar-all" data-maintain-selected="true" data-show-columns="true" data-show-toggle="true" data-toggle="table" data-pagination="true" data-search="true" class="table table-striped ext-list" id="softkey-all" data-unique-id="softkeys"> <table data-cookie="true" data-cookie-id-table="sccp_keyset-all" data-url="ajax.php?module=sccp_manager&command=getSoftKey&type=active" data-cache="false" data-show-refresh="true" data-toolbar="#toolbar-all" data-maintain-selected="true" data-show-columns="true" data-show-toggle="true" data-toggle="table" data-pagination="true" data-search="true" class="table table-striped ext-list" id="softkey-all" data-unique-id="softkeys">
<thead> <thead>
<tr> <tr>
<!-- <th data-checkbox="true"></th> --> <!-- <th data-checkbox="true"></th> -->

View file

@ -33,7 +33,7 @@
</ul> </ul>
</div> </div>
</div> </div>
<table data-cookie="true" data-row-style="SetRowColor" data-cookie-id-table="sccp_model-all" data-url="ajax.php?module=sccp_manager&amp;command=getDeviceModel&amp;type=enabled" data-cache="false" data-show-refresh="true" data-toolbar="#toolbar-model" data-maintain-selected="true" data-show-columns="true" data-show-toggle="true" data-toggle="table" data-pagination="true" data-search="true" class="table table-condensed" id="table-models" data-id="model" data-unique-id="model"> <table data-cookie="true" data-row-style="SetRowColor" data-cookie-id-table="sccp_model-all" data-url="ajax.php?module=sccp_manager&command=getDeviceModel&type=enabled" data-cache="false" data-show-refresh="true" data-toolbar="#toolbar-model" data-maintain-selected="true" data-show-columns="true" data-show-toggle="true" data-toggle="table" data-pagination="true" data-search="true" class="table table-condensed" id="table-models" data-id="model" data-unique-id="model">
<thead> <thead>
<tr> <tr>
<th data-checkbox="true"></th> <th data-checkbox="true"></th>

View file

@ -18,9 +18,9 @@ if (!empty($this->sccpvalues['system_rouminguser'])) {
<div class="display no-border"> <div class="display no-border">
<h1><?php echo _("Extensions (Line)") ?></h1> <h1><?php echo _("Extensions (Line)") ?></h1>
<div id="toolbar-sccp-extension"> <div id="toolbar-sccp-extension">
<a class="btn btn-default" href="config.php?display=extensions&amp;tech_hardware=sccp_custom"><i class="fa fa-plus">&nbsp;</i><?php echo _("Add Extension") ?></a> <a class="btn btn-default" href="config.php?display=extensions&tech_hardware=sccp_custom"><i class="fa fa-plus">&nbsp;</i><?php echo _("Add Extension") ?></a>
</div> </div>
<table data-cookie="true" data-cookie-id-table="sccp-extension-table" data-url="ajax.php?module=sccp_manager&amp;command=getExtensionGrid&amp;type=sccp" data-cache="false" data-show-refresh="true" data-toolbar="#toolbar-sip" data-maintain-selected="true" data-show-columns="true" data-show-toggle="true" data-toggle="table" data-pagination="true" data-search="true" class="table table-striped ext-list-sccp" id="table-sccp-extension" data-id="name"> <table data-cookie="true" data-cookie-id-table="sccp-extension-table" data-url="ajax.php?module=sccp_manager&command=getExtensionGrid&type=sccp" data-cache="false" data-show-refresh="true" data-toolbar="#toolbar-sip" data-maintain-selected="true" data-show-columns="true" data-show-toggle="true" data-toggle="table" data-pagination="true" data-search="true" class="table table-striped ext-list-sccp" id="table-sccp-extension" data-id="name">
<thead> <thead>
<tr> <tr>
<!-- <th data-checkbox="true"></th> --> <!-- <th data-checkbox="true"></th> -->
@ -39,12 +39,12 @@ if (!empty($this->sccpvalues['system_rouminguser'])) {
function DispayPhoneActionsKeyFormatter(value, row, index) { function DispayPhoneActionsKeyFormatter(value, row, index) {
var exp_dev = ''; var exp_dev = '';
var rmn_dev = '<?php echo $roming_enable ?>'; var rmn_dev = '<?php echo $roming_enable ?>';
exp_dev += '<a href="config.php?display=extensions&amp;extdisplay=' + row['name'] + '"><i class="fa fa-pencil"></i></a> &nbsp;'; exp_dev += "<a href="config.php?display=extensions&extdisplay=' + row['name'] + '"><i class="fa fa-pencil"></i></a> &nbsp;";
exp_dev += '<a class="clickable delete" data-id="' + row['name'] + '"><i class="fa fa-trash"></i></a>'; exp_dev += "<a class="clickable delete" data-id="' + row['name'] + '"><i class="fa fa-trash"></i></a>";
if (rmn_dev == 'yes') { if (rmn_dev == 'yes') {
exp_dev += '<a href="config.php?display=sccp_phone&amp;tech_hardware=r_user&amp;ru_id=' + row['name'] + '"><i class="fa fa-bicycle"></i></a> &nbsp;'; exp_dev += "<a href="config.php?display=sccp_phone&tech_hardware=r_user&ru_id=' + row['name'] + '"><i class="fa fa-bicycle"></i></a> &nbsp;";
} }
return exp_dev; return exp_dev;
return '<a href="config.php?display=extensions&amp;extdisplay=' + row['name'] + '"><i class="fa fa-pencil"></i></a> &nbsp;<a class="clickable delete" data-id="' + row['name'] + '"><i class="fa fa-trash"></i></a>'; return "<a href="config.php?display=extensions&extdisplay=' + row['name'] + '"><i class="fa fa-pencil"></i></a> &nbsp;<a class="clickable delete" data-id="' + row['name'] + '"><i class="fa fa-trash"></i></a>";
} }
</script> </script>

View file

@ -14,7 +14,7 @@
<div class="display no-border"> <div class="display no-border">
<h1><?php echo _("Device SCCP Phone") ?></h1> <h1><?php echo _("Device SCCP Phone") ?></h1>
<div id="toolbar-sccp-phone"> <div id="toolbar-sccp-phone">
<a class="btn btn-default" href="config.php?display=sccp_phone&amp;tech_hardware=cisco"><i class="fa fa-plus">&nbsp;</i><?php echo _("Add Device Phone") ?></a> <a class="btn btn-default" href="config.php?display=sccp_phone&tech_hardware=cisco"><i class="fa fa-plus">&nbsp;</i><?php echo _("Add Device Phone") ?></a>
<button id="remove-sccp-phone" class="btn btn-danger sccp_update btn-tab-select" data-id="delete_hardware" disabled> <button id="remove-sccp-phone" class="btn btn-danger sccp_update btn-tab-select" data-id="delete_hardware" disabled>
<i class="glyphicon glyphicon-remove"></i> <span><?php echo _('Delete') ?></span> <i class="glyphicon glyphicon-remove"></i> <span><?php echo _('Delete') ?></span>
</button> </button>
@ -31,7 +31,7 @@
<i class="glyphicon glyphicon-ok"></i> <span><?php echo _('Reset Token Device') ?></span> <i class="glyphicon glyphicon-ok"></i> <span><?php echo _('Reset Token Device') ?></span>
</button> </button>
</div> </div>
<table data-cookie="true" data-cookie-id-table="sccp-phone" data-url="ajax.php?module=sccp_manager&amp;command=getPhoneGrid&amp;type=sccp" data-cache="false" data-show-refresh="true" data-toolbar="#toolbar-sccp" data-maintain-selected="true" data-show-columns="true" data-show-toggle="true" data-toggle="table" data-pagination="true" data-search="true" class="table table-striped ext-list" id="table-sccp" data-id="mac"> <table data-cookie="true" data-cookie-id-table="sccp-phone" data-url="ajax.php?module=sccp_manager&command=getPhoneGrid&type=sccp" data-cache="false" data-show-refresh="true" data-toolbar="#toolbar-sccp" data-maintain-selected="true" data-show-columns="true" data-show-toggle="true" data-toggle="table" data-pagination="true" data-search="true" class="table table-striped ext-list" id="table-sccp" data-id="mac">
<thead> <thead>
<tr> <tr>
<th data-checkbox="true"></th> <th data-checkbox="true"></th>

View file

@ -14,7 +14,7 @@
<div class="display no-border"> <div class="display no-border">
<h1><?php echo _("Device SIP Phone") ?></h1> <h1><?php echo _("Device SIP Phone") ?></h1>
<div id="toolbar-sccp-sphone"> <div id="toolbar-sccp-sphone">
<a class="btn btn-default" href="config.php?display=sccp_phone&amp;tech_hardware=cisco-sip"><i class="fa fa-plus">&nbsp;</i><?php echo _("Add Device Phone") ?></a> <a class="btn btn-default" href="config.php?display=sccp_phone&tech_hardware=cisco-sip"><i class="fa fa-plus">&nbsp;</i><?php echo _("Add Device Phone") ?></a>
<button id="remove-sccp-sphone" class="btn btn-danger sccp_update btn-tab-select" data-id="delete_hardware" disabled> <button id="remove-sccp-sphone" class="btn btn-danger sccp_update btn-tab-select" data-id="delete_hardware" disabled>
<i class="glyphicon glyphicon-remove"></i> <span><?php echo _('Delete') ?></span> <i class="glyphicon glyphicon-remove"></i> <span><?php echo _('Delete') ?></span>
</button> </button>
@ -25,7 +25,7 @@
<i class="glyphicon glyphicon-ok"></i> <span><?php echo _('Reset Device') ?></span> <i class="glyphicon glyphicon-ok"></i> <span><?php echo _('Reset Device') ?></span>
</button> </button>
</div> </div>
<table data-cookie="true" data-cookie-id-table="sccp-sphone" data-url="ajax.php?module=sccp_manager&amp;command=getPhoneGrid&amp;type=cisco-sip" data-cache="false" data-show-refresh="true" data-toolbar="#toolbar-sip" data-maintain-selected="true" data-show-columns="true" data-show-toggle="true" data-toggle="table" data-pagination="true" data-search="true" class="table table-striped ext-list" id="table-sip" data-id="mac"> <table data-cookie="true" data-cookie-id-table="sccp-sphone" data-url="ajax.php?module=sccp_manager&command=getPhoneGrid&type=cisco-sip" data-cache="false" data-show-refresh="true" data-toolbar="#toolbar-sip" data-maintain-selected="true" data-show-columns="true" data-show-toggle="true" data-toggle="table" data-pagination="true" data-search="true" class="table table-striped ext-list" id="table-sip" data-id="mac">
<thead> <thead>
<tr> <tr>
<th data-checkbox="true"></th> <th data-checkbox="true"></th>