Add redirect after saving to sccp_line

Add redirect after saving to sccpline
Revert changes in page script formatting
This commit is contained in:
steve-lad 2021-06-10 16:57:19 +02:00
parent 214509e2c7
commit cf546961fe
4 changed files with 11 additions and 30 deletions

View file

@ -31,21 +31,8 @@ class Sccp extends \FreePBX\modules\Core\Driver {
); );
} }
/* public function addDevice1($id, $settings) {
$sql = 'INSERT INTO sccp (id, keyword, data, flags) values (?,?,?,?)';
$sth = $this->database->prepare($sql);
$settings = is_array($settings)?$settings:array();
foreach($settings as $key => $setting) {
$sth->execute(array($id,$key,$setting['value'],$setting['flag']));
}
return true;
}
*/
public function addDevice($id, $settings) { public function addDevice($id, $settings) {
$add_fld = array ("name"=>'label',"outboundcid"=>'cid_num',"langcode"=>'language',"extdisplay"=>'description'); $add_fld = array ("name"=>'label',"outboundcid"=>'cid_num',"langcode"=>'language',"extdisplay"=>'description');
// print_r($_REQUEST);
// echo '<br><br>';
// die(print_r($settings));
$settings['cid_num']['value'] = ''; $settings['cid_num']['value'] = '';
$settings['cid_name']['value'] = $label; $settings['cid_name']['value'] = $label;
$settings['mailbox']['value']= ''; $settings['mailbox']['value']= '';
@ -84,7 +71,6 @@ class Sccp extends \FreePBX\modules\Core\Driver {
} }
} }
// die(print_r($settings));
$tech = Array(); $tech = Array();
$sql = "DESCRIBE sccpline"; $sql = "DESCRIBE sccpline";
foreach ($this->database->query($sql) as $row) { foreach ($this->database->query($sql) as $row) {
@ -102,6 +88,7 @@ class Sccp extends \FreePBX\modules\Core\Driver {
$sth = $this->database->prepare($sql); $sth = $this->database->prepare($sql);
$sth->execute(); $sth->execute();
redirect('http://192.168.50.254/admin/config.php?display=sccp_phone', false);
return true; return true;
} }

View file

@ -6,15 +6,13 @@ trait bmoFunctions {
//Need to reload freePBX for modifications below to work //Need to reload freePBX for modifications below to work
//need to catch extensions //want to catch extensions
public static function myConfigPageInits() { public static function myConfigPageInits() {
dbug('have config page inits');
return array("extensions"); return array("extensions");
} }
public function doConfigPageInit($page) { public function doConfigPageInit($page) {
if ($page == "extensions") { if ($page == "extensions") {
dbug('have extensions in doConfigPageInit');
} }
$this->doGeneralPost(); $this->doGeneralPost();
} }
@ -25,19 +23,13 @@ trait bmoFunctions {
} }
public function doGuiHook(&$cc) { public function doGuiHook(&$cc) {
dbug('$_REQUEST', $_REQUEST);
//dbug('CC', $cc);
if ($_REQUEST['display'] == "extensions" ) { if ($_REQUEST['display'] == "extensions" ) {
if (isset($_REQUEST['tech_hardware'])) { if (isset($_REQUEST['tech_hardware'])) {
dbug('Have caught hook in doGuiHook'); //this is the add extensions form
$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() {
@ -64,6 +56,7 @@ trait bmoFunctions {
public function getActionBar($request) { public function getActionBar($request) {
$buttons = array(); $buttons = array();
dbug('Request in BMO is', $request);
switch ($request['display']) { switch ($request['display']) {
case 'sccp_adv': case 'sccp_adv':
if (empty($request['tech_hardware'])) { if (empty($request['tech_hardware'])) {
@ -132,6 +125,7 @@ trait bmoFunctions {
break; break;
case 'extensions': case 'extensions':
// only called from configpage inits // only called from configpage inits
dbug('in case extensions');
$buttons = array( $buttons = array(
'submit' => array( 'submit' => array(
'name' => 'ajaxsubmit', 'name' => 'ajaxsubmit',

View file

@ -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&extdisplay=' + row['name'] + '"><i class="fa fa-pencil"></i></a> &nbsp;"; exp_dev += '<a href="config.php?display=extensions&amp;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&tech_hardware=r_user&ru_id=' + row['name'] + '"><i class="fa fa-bicycle"></i></a> &nbsp;"; 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;';
} }
return exp_dev; return exp_dev;
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>"; 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>';
} }
</script> </script>

View file

@ -3,7 +3,7 @@
<i class="fa fa-list"></i>&nbsp; <i class="fa fa-list"></i>&nbsp;
<?php echo _("List Device")?> <?php echo _("List Device")?>
</a> </a>
<a class="btn btn-default" href="config.php?display=sccp_phone&amp;tech_hardware=cisco"> <a class="btn btn-default" href="config.php?display=sccp_phone&tech_hardware=cisco">
<i class="fa fa-plus">&nbsp;</i> <i class="fa fa-plus">&nbsp;</i>
<?php echo _("Add Device")?> <?php echo _("Add Device")?>
</a> </a>