Prerelease 19.09.2017
Fix .js Add formShow elements preparation for implementation <DIALTEMPLATE>
This commit is contained in:
parent
19585fed4c
commit
6d1678c1b2
|
@ -8,12 +8,18 @@
|
|||
// https://github.com/chan-sccp/chan-sccp/wiki/Conferencing
|
||||
// https://github.com/chan-sccp/chan-sccp/wiki/Frequently-Asked-Questions
|
||||
// http://chan-sccp-b.sourceforge.net/doc/_howto.xhtml#nf_adhoc_plar
|
||||
/*
|
||||
// https://www.cisco.com/c/en/us/td/docs/voice_ip_comm/cuipph/all_models/xsi/9-1-1/CUIP_BK_P82B3B16_00_phones-services-application-development-notes/CUIP_BK_P82B3B16_00_phones-services-application-development-notes_chapter_011.html
|
||||
// https://www.cisco.com/c/en/us/td/docs/voice_ip_comm/cuipph/7960g_7940g/sip/4_4/english/administration/guide/ver4_4/sipins44.html
|
||||
/*
|
||||
* ToDo:
|
||||
* + Cisco Format Mac
|
||||
* + Model Information
|
||||
* + Device Right Menu
|
||||
* - WiFi Config
|
||||
* + Dial Templates + Configuration
|
||||
* + Dial Templates in Global Configuration ( Enabled / Disabled ; default templet )
|
||||
* ? Dial Templates - Hoto IT Include in XML.Config ???????
|
||||
* - Dial Templates in device Configuration ( Enabled / inheret / Disabled ; templet )
|
||||
* - WiFi Config (Bulk Deployment Utility for Cisco 7921, 7925, 7926)?????
|
||||
* - suport kvstore ?????
|
||||
* - Shared Line ????
|
||||
* - bug Fix
|
||||
|
@ -32,7 +38,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
// const General - default.xml = '10';
|
||||
// const General - system_path = '2';
|
||||
// const General - don't store = '99';
|
||||
|
||||
|
||||
private $SCCP_LANG_DICTIONARY = 'SCCP-dictionary.xml'; // CISCO LANG file search in /tftp-path
|
||||
private $pagedata = null;
|
||||
private $tftpLang = array();
|
||||
|
@ -117,9 +123,9 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
$this->FreePBX = $freepbx;
|
||||
$this->db = $freepbx->Database;
|
||||
$this->cnf_wr = \FreePBX::WriteConfig();
|
||||
$this->cnf_read =\FreePBX::LoadConfig();
|
||||
|
||||
|
||||
$this->cnf_read = \FreePBX::LoadConfig();
|
||||
|
||||
|
||||
$this->v = new \Respect\Validation\Validator();
|
||||
|
||||
$this->getSccpSettingsDB(false); // Overwrite Exist
|
||||
|
@ -127,7 +133,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
$this->init_sccp_path();
|
||||
$this->initVarfromDefs();
|
||||
$this->initTftpLang();
|
||||
|
||||
|
||||
|
||||
// Load Advanced Form Constuctor Data
|
||||
if (file_exists(__DIR__ . '/views/sccpgeneral.xml')) {
|
||||
|
@ -201,7 +207,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
}
|
||||
}
|
||||
}
|
||||
if ($child['type'] == 'IS' || $child['type'] == 'IED' ) {
|
||||
if ($child['type'] == 'IS' || $child['type'] == 'IED') {
|
||||
if (empty($child->value)) {
|
||||
$datav = (string) $child->default;
|
||||
} else {
|
||||
|
@ -212,7 +218,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
// $this->sccpvalues[] = array('keyword' => (string)$child->name, 'data' =>(string)$child-> default,'type'=>'0');
|
||||
}
|
||||
}
|
||||
if ($child['type'] == 'SLD' || $child['type'] == 'SLS' || $child['type'] == 'SLT' || $child['type'] == 'SL' || $child['type'] == 'SLM' || $child['type'] == 'SLZ' || $child['type'] == 'SLZN') {
|
||||
if ($child['type'] == 'SLD' || $child['type'] == 'SLS' || $child['type'] == 'SLT' || $child['type'] == 'SL' || $child['type'] == 'SLM' || $child['type'] == 'SLZ' || $child['type'] == 'SLZN' || $child['type'] == 'SLA') {
|
||||
if (empty($child->value)) {
|
||||
$datav = (string) $child->default;
|
||||
} else {
|
||||
|
@ -251,6 +257,31 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
public function getActionBar($request) {
|
||||
$buttons = array();
|
||||
switch ($request['display']) {
|
||||
case 'sccp_adv':
|
||||
if (empty($request['tech_hardware'])) {
|
||||
break;
|
||||
}
|
||||
$buttons = array(
|
||||
'submit' => array(
|
||||
'name' => 'ajaxsubmit',
|
||||
'id' => 'ajaxsubmit',
|
||||
'value' => _("Save")
|
||||
),
|
||||
'Save' => array(
|
||||
'name' => 'ajaxsubmit2',
|
||||
'id' => 'ajaxsubmit2',
|
||||
'stayonpage' => 'yes',
|
||||
'value' => _("Save + Continue")
|
||||
),
|
||||
'cancel' => array(
|
||||
'name' => 'cancel',
|
||||
'id' => 'ajaxcancel',
|
||||
'data-search' => '?display=sccp_adv',
|
||||
'data-hash' => 'sccpdialplan',
|
||||
'value' => _("Cancel")
|
||||
),
|
||||
);
|
||||
break;
|
||||
case 'sccp_phone':
|
||||
if (empty($request['tech_hardware'])) {
|
||||
break;
|
||||
|
@ -326,14 +357,6 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
"name" => _("SCCP Codec"),
|
||||
"page" => 'views/server.codec.php'
|
||||
),
|
||||
"sccpkeyset" => array(
|
||||
"name" => _("SCCP Device Keyset"),
|
||||
"page" => 'views/server.keyset.php'
|
||||
),
|
||||
"sccpmodels" => array(
|
||||
"name" => _("SCCP Model information"),
|
||||
"page" => 'views/server.model.php'
|
||||
)
|
||||
);
|
||||
|
||||
foreach ($this->pagedata as &$page) {
|
||||
|
@ -347,6 +370,50 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
return $this->pagedata;
|
||||
}
|
||||
|
||||
public function AdvServerShowPage() {
|
||||
$request = $_REQUEST;
|
||||
$action = !empty($request['action']) ? $request['action'] : '';
|
||||
$inputform = !empty($request['tech_hardware']) ? $request['tech_hardware'] : '';
|
||||
|
||||
// print_r($inputform);
|
||||
if (empty($this->pagedata)) {
|
||||
switch ($inputform) {
|
||||
case dialplan:
|
||||
$this->pagedata = array(
|
||||
"general" => array(
|
||||
"name" => _("SCCP Dial Plan information"),
|
||||
"page" => 'views/form.dptemplet.php'
|
||||
)
|
||||
);
|
||||
break;
|
||||
default:
|
||||
$this->pagedata = array(
|
||||
"general" => array(
|
||||
"name" => _("SCCP Model information"),
|
||||
"page" => 'views/server.model.php'
|
||||
),
|
||||
"sccpkeyset" => array(
|
||||
"name" => _("SCCP Device Keyset"),
|
||||
"page" => 'views/server.keyset.php'
|
||||
),
|
||||
// "sccpdialplan" => array(
|
||||
// "name" => _("SCCP Dial Plan information"),
|
||||
// "page" => 'views/server.dialtemplet.php'
|
||||
// )
|
||||
);
|
||||
break;
|
||||
}
|
||||
foreach ($this->pagedata as &$page) {
|
||||
ob_start();
|
||||
include($page['page']);
|
||||
$page['content'] = ob_get_contents();
|
||||
ob_end_clean();
|
||||
}
|
||||
}
|
||||
|
||||
return $this->pagedata;
|
||||
}
|
||||
|
||||
public function PhoneShowPage() {
|
||||
$request = $_REQUEST;
|
||||
$action = !empty($request['action']) ? $request['action'] : '';
|
||||
|
@ -427,22 +494,25 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
|
||||
return $this->pagedata;
|
||||
}
|
||||
|
||||
public function getRightNav($request) {
|
||||
if(isset($request['tech_hardware']) && ($request['tech_hardware'] == 'cisco')) {
|
||||
return load_view(__DIR__."/views/hardware.rnav.php",array('request' => $request));
|
||||
}
|
||||
if (isset($request['tech_hardware']) && ($request['tech_hardware'] == 'cisco')) {
|
||||
return load_view(__DIR__ . "/views/hardware.rnav.php", array('request' => $request));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function ajaxRequest($req, &$setting) {
|
||||
switch ($req) {
|
||||
case 'savesettings':
|
||||
case "save_hardware":
|
||||
case "save_dp_templet":
|
||||
case "delete_hardware":
|
||||
case "getPhoneGrid":
|
||||
case "getExtensionGrid":
|
||||
case "getDeviceModel":
|
||||
case "getUserGrid":
|
||||
case "getSoftKey":
|
||||
case "getDialTemplete":
|
||||
case "create_hw_tftp":
|
||||
case "reset_dev":
|
||||
case "model_enabled":
|
||||
|
@ -452,6 +522,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
case "model_delete":
|
||||
case "updateSoftKey":
|
||||
case "deleteSoftKey":
|
||||
case "delete_dialplan":
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
|
@ -481,6 +552,23 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
|
||||
return $this->save_hw_phone($request);
|
||||
|
||||
break;
|
||||
case "save_dp_templet":
|
||||
$res = $this->save_DialPlant($request);
|
||||
if (empty($res)) {
|
||||
return array('status' => true, 'search' => '?display=sccp_adv', 'hash' => 'sccpdialplan');
|
||||
} else {
|
||||
return array('status' => false, 'message' => print_r($res));
|
||||
}
|
||||
break;
|
||||
case "delete_dialplan":
|
||||
if (!empty($request['dialplan'])) {
|
||||
$get_file = $request['dialplan'];
|
||||
$res = $this->del_DialPlant($get_file);
|
||||
return array('status' => true, 'message' => 'Dial Templet is Delete ! ', 'table_reload'=>true);
|
||||
} else {
|
||||
return array('status' => false, 'message' => print_r($res));
|
||||
}
|
||||
break;
|
||||
case 'delete_hardware':
|
||||
if (!empty($request['idn'])) {
|
||||
|
@ -659,6 +747,15 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
}
|
||||
return $result;
|
||||
break;
|
||||
|
||||
case "getDialTemplete":
|
||||
$result = $this->get_DP_list();
|
||||
if (empty($result)) {
|
||||
$result = array();
|
||||
}
|
||||
return $result;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -673,16 +770,15 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
* * Save Hardware Device Information to Db + ???? Create / update XML Profile
|
||||
*
|
||||
*/
|
||||
|
||||
function save_hw_phone($get_settings, $validateonly = false) {
|
||||
$hdr_prefix = 'sccp_hw_';
|
||||
$save_buttons = array();
|
||||
$save_settings = array();
|
||||
$save_codec = array();
|
||||
$def_feature = array('parkinglot' => array('name'=>'P.slot','value' => 'default'),
|
||||
'devstate' => array('name'=> 'Coffee', 'value' => 'coffee'),
|
||||
'monitor' => array('name'=>'Record Calls', 'value'=>'')
|
||||
);
|
||||
$def_feature = array('parkinglot' => array('name' => 'P.slot', 'value' => 'default'),
|
||||
'devstate' => array('name' => 'Coffee', 'value' => 'coffee'),
|
||||
'monitor' => array('name' => 'Record Calls', 'value' => '')
|
||||
);
|
||||
$name_dev = '';
|
||||
$db_field = $this->get_db_SccpTableData("get_colums_sccpdevice");
|
||||
$hw_id = (empty($get_settings['sccp_deviceid'])) ? 'new' : $get_settings['sccp_deviceid'];
|
||||
|
@ -696,9 +792,9 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
$value = $get_settings[$hdr_prefix . $key . '_net'] . '/' . $get_settings[$hdr_prefix . $key . '_mask'];
|
||||
break;
|
||||
case 'name':
|
||||
if (!empty($get_settings[$hdr_prefix . 'mac'])) {
|
||||
if (!empty($get_settings[$hdr_prefix . 'mac'])) {
|
||||
$value = $get_settings[$hdr_prefix . 'mac'];
|
||||
$value = 'SEP' . strtoupper(str_replace(array('.','-',':'),'',$value)); // Delete mac Seporated from string
|
||||
$value = 'SEP' . strtoupper(str_replace(array('.', '-', ':'), '', $value)); // Delete mac Seporated from string
|
||||
$name_dev = $value;
|
||||
}
|
||||
break;
|
||||
|
@ -753,18 +849,18 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
$btn_opt = $btn_f;
|
||||
if (!empty($def_feature[$btn_f]['value'])) {
|
||||
if (empty($get_settings['button' . $it . '_fvalue'])) {
|
||||
$btn_opt .= ','.$def_feature[$btn_f]['value'];
|
||||
$btn_opt .= ',' . $def_feature[$btn_f]['value'];
|
||||
} else {
|
||||
$btn_opt .= ','.$get_settings['button' . $it . '_fvalue'];
|
||||
$btn_opt .= ',' . $get_settings['button' . $it . '_fvalue'];
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'monitor':
|
||||
$btn_t = 'speeddial';
|
||||
$btn_opt = (string) $get_settings['button' . $it . '_line'];
|
||||
$db_res = $this->get_db_SccpTableData('SccpExtension',array('id'=>$btn_opt));
|
||||
$db_res = $this->get_db_SccpTableData('SccpExtension', array('id' => $btn_opt));
|
||||
$btn_n = $db_res[0]['label'];
|
||||
$btn_opt .= ',' . $btn_opt. $this->hint_context;
|
||||
$btn_opt .= ',' . $btn_opt . $this->hint_context;
|
||||
break;
|
||||
case 'speeddial':
|
||||
if (!empty($get_settings['button' . $it . '_input'])) {
|
||||
|
@ -814,7 +910,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
$this->sccp_create_device_XML($name_dev);
|
||||
// sccp restart
|
||||
// $this->sccp_core_comands(array('cmd'=>'reset_phone', 'name' => $name_dev));
|
||||
$this->sccp_core_comands(array('cmd'=>'reload_phone', 'name' => $name_dev));
|
||||
$this->sccp_core_comands(array('cmd' => 'reload_phone', 'name' => $name_dev));
|
||||
// die();
|
||||
return $save_settings;
|
||||
}
|
||||
|
@ -844,21 +940,20 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
$arr_data = '';
|
||||
if (!empty($this->sccpvalues[$key1])) {
|
||||
foreach ($value as $vkey => $vval) {
|
||||
$tmp_data ='';
|
||||
$tmp_data = '';
|
||||
foreach ($vval as $vkey => $vval) {
|
||||
$tmp_data .= $vval. '/';
|
||||
}
|
||||
if (strlen($tmp_data)>2){
|
||||
$arr_data .= substr($tmp_data,0,-1).';';
|
||||
$tmp_data .= $vval . '/';
|
||||
}
|
||||
if (strlen($tmp_data) > 2) {
|
||||
$arr_data .= substr($tmp_data, 0, -1) . ';';
|
||||
}
|
||||
}
|
||||
$arr_data = substr($arr_data,0,-1);
|
||||
$arr_data = substr($arr_data, 0, -1);
|
||||
if (!($this->sccpvalues[$key1]['data'] == $arr_data)) {
|
||||
$save_settings[] = array('keyword' => $this->sccpvalues[$key1]['keyword'], 'data' => $arr_data,
|
||||
'seq' => $this->sccpvalues[$key1]['seq'], 'type' => $this->sccpvalues[$key1]['type']);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
switch ($key) {
|
||||
case 'voicecodecs':
|
||||
|
@ -1014,17 +1109,17 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
$line_arr = explode(' ', $line);
|
||||
$it = 1;
|
||||
do {
|
||||
if (strpos($line_arr[$it + 1],'SEP') === false) {
|
||||
$line_arr[0] .= ' '.$line_arr[$it];
|
||||
if (strpos($line_arr[$it + 1], 'SEP') === false) {
|
||||
$line_arr[0] .= ' ' . $line_arr[$it];
|
||||
unset($line_arr[$it]);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
$it++;
|
||||
} while ((count($line_arr)> 3) and ($it<count($line_arr)));
|
||||
explode(";|",implode(";|",$line_arr));
|
||||
list ($descr, $adress, $devname, $status, $junk) = explode(";|",implode(";|",$line_arr));
|
||||
|
||||
$it++;
|
||||
} while ((count($line_arr) > 3) and ( $it < count($line_arr)));
|
||||
explode(";|", implode(";|", $line_arr));
|
||||
list ($descr, $adress, $devname, $status, $junk) = explode(";|", implode(";|", $line_arr));
|
||||
|
||||
// list ($descr, $adress, $devname, $status, $junk) = $line_arr;
|
||||
|
||||
if (isset($ast_key[$devname])) {
|
||||
|
@ -1401,6 +1496,15 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (!empty($this->sccppath["tftp_path"])) {
|
||||
$this->sccppath["tftp_DP"] = $this->sccppath["tftp_path"] . '/Dialplan';
|
||||
if (!file_exists($this->sccppath["tftp_DP"])) {
|
||||
if (!mkdir($this->sccppath["tftp_DP"], 0777, true)) {
|
||||
die('Error create DialPlan templet dir');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($_SERVER['DOCUMENT_ROOT'])) {
|
||||
return;
|
||||
}
|
||||
|
@ -1425,10 +1529,99 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
}
|
||||
|
||||
$this->sccp_conf_init = $this->cnf_read->getConfig('sccp.conf');
|
||||
|
||||
|
||||
// $this->sccp_conf_init = @parse_ini_file($this->sccppath["sccp_conf"], true);
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
function get_DP_list() {
|
||||
$dir = $this->sccppath["tftp_DP"].'/*.xml';
|
||||
$base_len = strlen($this->sccppath["tftp_DP"])+ 1;
|
||||
$res = glob($dir);
|
||||
$dp_list = array();
|
||||
foreach ($res as $key => $value) {
|
||||
$res[$key] = array('id'=> substr($value,$base_len,-4), 'file' => substr($value,$base_len));
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
function get_DialPlant($get_file) {
|
||||
$file = $this->sccppath["tftp_DP"].'/'.$get_file.'.xml';
|
||||
if (file_exists($file)) {
|
||||
// $load_xml_data = simplexml_load_file($file);
|
||||
|
||||
$fileContents= file_get_contents($file);
|
||||
$fileContents = str_replace(array("\n", "\r", "\t"), '', $fileContents);
|
||||
$fileContents = trim(str_replace('"', "'", $fileContents));
|
||||
$fileContents = strtolower($fileContents);
|
||||
$res = (array) simplexml_load_string($fileContents);
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
|
||||
function del_DialPlant($get_file) {
|
||||
if (!empty($get_file)) {
|
||||
$file = $this->sccppath["tftp_DP"].'/'.$get_file.'.xml';
|
||||
if (file_exists($file)) {
|
||||
$res = unlink($file);
|
||||
}
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
function save_DialPlant($get_settings) {
|
||||
$xmlstr = "<DIALTEMPLATE>\n";
|
||||
$dialFelds = array('match','timeout','rewrite','tone'); //str -to lo !
|
||||
|
||||
$hdr_prefix = 'sccp_dial_';
|
||||
$hdr_arprefix = 'sccp_dial-ar_';
|
||||
$save_data = array();
|
||||
$integer_msg = _("%s must be a non-negative integer");
|
||||
$errors = array();
|
||||
foreach ($get_settings[$hdr_arprefix.'dialtemplete'] as $key => $value) {
|
||||
$xmlstr .= '<TEMPLATE';
|
||||
if (!empty($value['match'])) {
|
||||
foreach ($dialFelds as $fld){
|
||||
if (isset($value[$fld]) ) {
|
||||
if ($value[$fld] == 'empty' || $value[$fld] == '') {
|
||||
//
|
||||
} else {
|
||||
$xmlstr .= ' '.$fld.'="'.(string)$value[$fld].'"';
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$errors = array('Fields "match" is requered !!');
|
||||
|
||||
}
|
||||
$xmlstr .= "/>\n";
|
||||
}
|
||||
$xmlstr .= '</DIALTEMPLATE>';
|
||||
if (!empty($get_settings['idtemplet'])) {
|
||||
if ($get_settings['idtemplet'] == '*new*') {
|
||||
if (!empty($get_settings[$hdr_prefix.'dialtemplete_name'])) {
|
||||
$put_file = (string)$get_settings[$hdr_prefix.'dialtemplete_name'];
|
||||
} else { $errors = array('Fields Dial Plan Name is requered !!'); }
|
||||
} else $put_file = (string)$get_settings['idtemplet'];
|
||||
} else { $errors = array('Fields Dial Plan Name is requered !!'); }
|
||||
|
||||
if (empty($errors)) {
|
||||
// $put_file = 'test';
|
||||
$put_file = str_replace(array("\n", "\r", "\t","/","\\",".",","), '', $put_file);
|
||||
$file = $this->sccppath["tftp_DP"].'/'.$put_file.'.xml';
|
||||
file_put_contents($file, $xmlstr);
|
||||
}
|
||||
|
||||
return $errors;
|
||||
}
|
||||
|
||||
/*
|
||||
* Save Config Value to mysql DB
|
||||
* sccp_db_save_setting(empty) - Save All settings from $sccpvalues
|
||||
|
@ -1719,18 +1912,18 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
$xml_work->$key = $var_hw_config["loadimage"];
|
||||
if (!empty($var_hw_config['addon'])) {
|
||||
$hw_addon = explode(',', $var_hw_config['addon']);
|
||||
$xnode = $xml_work -> addChild('addOnModules');
|
||||
$xnode = $xml_work->addChild('addOnModules');
|
||||
$ti = 1;
|
||||
foreach ($hw_addon as $key ) {
|
||||
$hw_inf = $this-> getSccp_model_information('byid',false, "all",array('model'=>$key ));
|
||||
$xnode_obj = $xnode -> addChild('addOnModule');
|
||||
foreach ($hw_addon as $key) {
|
||||
$hw_inf = $this->getSccp_model_information('byid', false, "all", array('model' => $key));
|
||||
$xnode_obj = $xnode->addChild('addOnModule');
|
||||
// if $hw_inf['loadimage']
|
||||
$xnode_obj -> addAttribute('idx', $ti);
|
||||
$xnode_obj -> addChild('loadInformation',$hw_inf[0]['loadimage']);
|
||||
$xnode_obj->addAttribute('idx', $ti);
|
||||
$xnode_obj->addChild('loadInformation', $hw_inf[0]['loadimage']);
|
||||
$ti ++;
|
||||
}
|
||||
// $this->appendSimpleXmlNode($xml_work , $xnode_obj);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'userLocale':
|
||||
case 'networkLocaleInfo':
|
||||
|
@ -1739,14 +1932,14 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
if (!empty($var_hw_config["hwlang"])) {
|
||||
$hwlang = explode(':', $var_hw_config["hwlang"]);
|
||||
}
|
||||
if (($key == 'networkLocaleInfo') || ($key == 'networkLocale') ){
|
||||
if (($key == 'networkLocaleInfo') || ($key == 'networkLocale')) {
|
||||
// $lang=$this->sccpvalues['netlang']['data'];
|
||||
$lang = (empty($hwlang[0])) ? $this->sccpvalues['netlang']['data'] : $hwlang[0];
|
||||
} else {
|
||||
$lang = (empty($hwlang[1])) ? $this->sccpvalues['devlang']['data'] : $hwlang[1];
|
||||
// $lang=$this->sccpvalues['devlang']['data'];
|
||||
}
|
||||
if ($key == 'networkLocale'){
|
||||
if ($key == 'networkLocale') {
|
||||
$xml_work->$key = $lang;
|
||||
} else {
|
||||
$xml_node->name = $this->sccp_lang[$lang]['locale'];
|
||||
|
@ -1794,7 +1987,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
case "tftp_path":
|
||||
break;
|
||||
default:
|
||||
$this->sccp_conf_init['general'][$key] = $value['data'];
|
||||
$this->sccp_conf_init['general'][$key] = $value['data'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1820,8 +2013,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
$sql = "SELECT * FROM `sccpline` ORDER BY `id`";
|
||||
$raw_settings = sql($sql, "getAll", DB_FETCHMODE_ASSOC);
|
||||
} else {
|
||||
$sql = "SELECT * FROM `sccpline` WHERE `id`=".$data['id'];
|
||||
$raw_settings = sql($sql, "getAll", DB_FETCHMODE_ASSOC);
|
||||
$sql = "SELECT * FROM `sccpline` WHERE `id`=" . $data['id'];
|
||||
$raw_settings = sql($sql, "getAll", DB_FETCHMODE_ASSOC);
|
||||
}
|
||||
break;
|
||||
case "SccpDevice":
|
||||
|
@ -1877,7 +2070,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
|
||||
function getSccp_model_information($get = "all", $validate = false, $format_list = "all", $filter = array()) {
|
||||
global $db;
|
||||
$file_ext = array('.loads','.LOADS','.sbn','.SBN','.bin','.BIN');
|
||||
$file_ext = array('.loads', '.LOADS', '.sbn', '.SBN', '.bin', '.BIN');
|
||||
|
||||
$dir = $this->sccppath["tftp_path"];
|
||||
$dir_tepl = $this->sccppath["tftp_templets"];
|
||||
|
@ -1898,7 +2091,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
case "byid":
|
||||
if (!empty($filter)) {
|
||||
if (!empty($filter['model'])) {
|
||||
$sql = "SELECT " . $sel_inf . " FROM sccpdevmodel WHERE (`model` =".$filter['model'].") ORDER BY model ";
|
||||
$sql = "SELECT " . $sel_inf . " FROM sccpdevmodel WHERE (`model` =" . $filter['model'] . ") ORDER BY model ";
|
||||
} else {
|
||||
// $sql = "SELECT ".$filter['model'];
|
||||
$sql = "SELECT " . $sel_inf . " FROM sccpdevmodel ORDER BY model ";
|
||||
|
@ -1907,7 +2100,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
}
|
||||
break;
|
||||
case "extension":
|
||||
$sql = "SELECT " . $sel_inf . " FROM sccpdevmodel WHERE (dns = 0)ORDER BY model ";
|
||||
$sql = "SELECT " . $sel_inf . " FROM sccpdevmodel WHERE (dns = 0)ORDER BY model ";
|
||||
break;
|
||||
case "enabled":
|
||||
case "phones":
|
||||
|
@ -1926,15 +2119,15 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
$raw_settings[$i]['validate'] = '-;-';
|
||||
if (!empty($raw_settings[$i]['loadimage'])) {
|
||||
$file = $dir . '/' . $raw_settings[$i]['loadimage'];
|
||||
if (is_dir($file)){
|
||||
if (is_dir($file)) {
|
||||
$file .= '/' . $raw_settings[$i]['loadimage'];
|
||||
}
|
||||
$raw_settings[$i]['validate'] = 'no;';
|
||||
if (strtolower($raw_settings[$i]['vendor']) == 'cisco') {
|
||||
if (strtolower($raw_settings[$i]['vendor']) == 'cisco') {
|
||||
foreach ($file_ext as $value) {
|
||||
if (file_exists($file.$value)) {
|
||||
if (file_exists($file . $value)) {
|
||||
$raw_settings[$i]['validate'] = 'yes;';
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -1955,7 +2148,6 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO {
|
|||
} else {
|
||||
$raw_settings[$i]['validate'] .= '-';
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return $raw_settings;
|
||||
|
|
|
@ -33,6 +33,10 @@ $(document).ready(function () {
|
|||
if ($('.fpbx-submit').data('id') == "hw_edit") {
|
||||
snd_command = 'save_hardware';
|
||||
}
|
||||
if ($('.fpbx-submit').data('id') == "dial_templet") {
|
||||
snd_command = 'save_dp_templet';
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'ajax.php?module=sccp_manager&command=' + snd_command,
|
||||
|
@ -64,6 +68,9 @@ $(document).ready(function () {
|
|||
if ($('.fpbx-submit').data('id') == "hw_edit") {
|
||||
snd_command = 'save_hardware';
|
||||
}
|
||||
if ($('.fpbx-submit').data('id') == "dial_templet") {
|
||||
snd_command = 'save_dp_templet';
|
||||
}
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'ajax.php?module=sccp_manager&command=' + snd_command,
|
||||
|
@ -107,6 +114,73 @@ $(document).ready(function () {
|
|||
add_dynamic_input($(this),$(this).data('for'),"","");
|
||||
});
|
||||
|
||||
$(".table").on('click','.table-js-add', function (e) {
|
||||
add_dynamic_table($(this),$(this).data('for'),"","");
|
||||
});
|
||||
|
||||
$(".table").on('click','.table-js-del', function (e) {
|
||||
del_dynamic_table($(this),$(this).data('for'));
|
||||
});
|
||||
|
||||
|
||||
$(".table").on('click','.btn-item-delete', function (e) {
|
||||
var dev_cmd = '';
|
||||
var dev_id = $(this).data('id');
|
||||
var dev_for = $(this).data('for');
|
||||
var ext_data = '';
|
||||
if (dev_for =='softkeys') {
|
||||
dev_cmd = 'deleteSoftKey';
|
||||
ext_data = "softkey=" + dev_id;
|
||||
}
|
||||
if (dev_for =='model') {
|
||||
dev_cmd = 'model_delete';
|
||||
ext_data = "model=" + dev_id;
|
||||
}
|
||||
if (dev_for =='dialplan') {
|
||||
dev_cmd = 'delete_dialplan';
|
||||
ext_data = "dialplan=" + dev_id;
|
||||
}
|
||||
if (dev_for =='hardware') {
|
||||
dev_cmd = 'delete_hardware';
|
||||
ext_data = "idn[0]=" + dev_id;
|
||||
}
|
||||
// console.log("delete : " + data);
|
||||
if (dev_cmd != '') {
|
||||
if (confirm(_('Are you sure you wish to delete "' + dev_id.toString().toUpperCase() + '" inormation ?'))) {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'ajax.php?module=sccp_manager&command=' + dev_cmd,
|
||||
command: dev_cmd,
|
||||
data: ext_data,
|
||||
success: function (data) {
|
||||
// console.log(data);
|
||||
if (data.status === true) {
|
||||
if (data.message) {
|
||||
alert(data.message);
|
||||
}
|
||||
if (data.table_reload === true) {
|
||||
$('table').bootstrapTable('refresh');
|
||||
}
|
||||
if (data.reload === true) {
|
||||
location.reload();
|
||||
}
|
||||
} else {
|
||||
if (Array.isArray(data.message)) {
|
||||
data.message.forEach(function (entry) {
|
||||
fpbxToast(entry, 'error', 'error');
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
// ----------------------- Server.model.Button.Select----------------
|
||||
|
||||
$('.dropdown-menu a.dropitem').on("click", function (e) {
|
||||
|
@ -448,11 +522,13 @@ $("table").on('uncheck-all.bs.table', function (rows) {
|
|||
});
|
||||
|
||||
//
|
||||
// On table Click !!!!!!
|
||||
$("table").on("post-body.bs.table", function () {
|
||||
// console.log('Table ');
|
||||
// delete extension
|
||||
$(this).find(".clickable.delete").click(function () {
|
||||
var id = $(this).data("id");
|
||||
// console.log(id);
|
||||
|
||||
if (confirm(_("Are you sure you wish to delete this extension?"))) {
|
||||
$.post("ajax.php", {command: "delete", module: "core", extensions: [id], type: "extensions"}, function (data) {
|
||||
if (data.status) {
|
||||
|
@ -469,6 +545,7 @@ $("table").on("post-body.bs.table", function () {
|
|||
}
|
||||
});
|
||||
});
|
||||
|
||||
function load_oncliсk(e, data) {
|
||||
|
||||
// console.log('load_oncliсk');
|
||||
|
@ -526,51 +603,7 @@ function load_oncliсk(e, data) {
|
|||
}
|
||||
}
|
||||
|
||||
function delete_oncliсk(e, data) {
|
||||
var dev_cmd = '';
|
||||
var datas = '';
|
||||
if (e.href.indexOf('#delete_softkeys') > 0) {
|
||||
dev_cmd = 'deleteSoftKey';
|
||||
datas = "softkey=" + data;
|
||||
}
|
||||
if (e.href.indexOf('#delete_model') > 0) {
|
||||
dev_cmd = 'model_delete';
|
||||
datas = "model=" + data;
|
||||
}
|
||||
if (e.href.indexOf('#delete_hardware') > 0) {
|
||||
dev_cmd = 'delete_hardware';
|
||||
datas = "idn[0]=" + data;
|
||||
}
|
||||
// console.log("delete : " + data);
|
||||
if (confirm(_('Are you sure you wish to delete "' + data.toUpperCase() + '" inormation ?'))) {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'ajax.php?module=sccp_manager&command=' + dev_cmd,
|
||||
data: datas,
|
||||
success: function (data) {
|
||||
// console.log(data);
|
||||
if (data.status === true) {
|
||||
if (data.message) {
|
||||
alert(data.message);
|
||||
}
|
||||
if (data.table_reload === true) {
|
||||
$('table').bootstrapTable('refresh');
|
||||
}
|
||||
if (data.reload === true) {
|
||||
location.reload();
|
||||
}
|
||||
} else {
|
||||
if (Array.isArray(data.message)) {
|
||||
data.message.forEach(function (entry) {
|
||||
fpbxToast(entry, 'error', 'error');
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
function add_dynamic_input(pe, pclass, vdefault) {
|
||||
// We'd like a new one, please.
|
||||
pcls = pe.data('for');
|
||||
|
@ -594,6 +627,80 @@ function add_dynamic_input(pe, pclass, vdefault) {
|
|||
last.after(html);
|
||||
}
|
||||
|
||||
function del_dynamic_table(pe, pclass, vdefault) {
|
||||
pcls = pe.data('for');
|
||||
pname = pe.data('id');
|
||||
|
||||
// pe.preventDefault();
|
||||
var rowCount = $('#dp-table-'+pcls+'>tbody >tr').length;
|
||||
curRow =$('#'+pcls+'-row-'+ pname);
|
||||
var curRow = pe.closest('tr');
|
||||
if(rowCount > 1){
|
||||
curRow.fadeOut("slow", function(){
|
||||
$(this).remove();
|
||||
});
|
||||
}else{
|
||||
curRow.find('input:text').each(function(){$(this).val('')});
|
||||
}
|
||||
}
|
||||
|
||||
function add_dynamic_table(pe, pclass, vdefault) {
|
||||
// We'd like a new one, please.
|
||||
pcls = pe.data('for');
|
||||
pname = pe.data('id');
|
||||
jdata = JSON.parse(hex2bin(pe.data('json')));
|
||||
|
||||
var last = $("."+pcls+":last"),
|
||||
ourid = last.data('nextid'),
|
||||
nextid = ourid + 1;
|
||||
var html = "<tr class = '" + pcls +"' data-nextid="+nextid+">";
|
||||
for (var key in jdata) {
|
||||
html_opt = '';
|
||||
res_ni = pcls + '_' + nextid + '_' + key;
|
||||
res_n = pcls + '[' + nextid + '][' + key + ']';
|
||||
for (var skey in jdata[key]['options']) {
|
||||
html_opt += ' ' + skey+'="' + jdata[key]['options'][skey] +'"';
|
||||
}
|
||||
var html_rs = '<div class="input-group"> <span class="input-group-addon" id="basep_' + res_ni + '" >' + jdata[key]['display_prefix'] + '</span>';
|
||||
var html_re = '<span class="input-group-addon" id="bases_' + res_ni + '">' + jdata[key]['display_sufix'] + '</span></div>';
|
||||
|
||||
html += '<td class="">';
|
||||
switch (jdata[key]['type']) {
|
||||
case "title":
|
||||
break;
|
||||
case "label":
|
||||
html +='<label ' + html_opt +' >' + jdata[key]['data'] + '</label>';
|
||||
break;
|
||||
case "input":
|
||||
html += html_rs + '<input type="text" name="' + res_n + '" value="' + '"' + html_opt + '>' +html_re ;
|
||||
break;
|
||||
case "number":
|
||||
html += html_rs + '<input type="number" name="' + res_n + '" value="' + '"' + html_opt + '>' +html_re ;
|
||||
break;
|
||||
case "date":
|
||||
html += html_rs + '<input type="date" name="' + res_n + '" value="' + '"' + html_opt + '>' +html_re ;
|
||||
break;
|
||||
case "select":
|
||||
html += html_rs + '<select name="' + res_n + '" id="' + res_n + '"' + html_opt + ">";
|
||||
sel_data = jdata[key]['data'].split(';');
|
||||
for (var dkey in sel_data) {
|
||||
html += '<option>' + sel_data[dkey] + '</option>';
|
||||
}
|
||||
html += '</select>'+ html_re;
|
||||
break;
|
||||
}
|
||||
html += '</td>';
|
||||
}
|
||||
html += '<td><input type="button" id="' + pcls+ nextid + '-btn" data-id="' + nextid + '" data-for="' + pcls + '"data-json="'+ pe.data('json') + '" class="table-js-add" value="+" />';
|
||||
html += '<input type="button" id="'+ pcls+ nextid +'-btndel" data-id="'+ nextid + '" data-for="' + pcls + '" class="table-js-del" value="-" />';
|
||||
|
||||
// html += '<a href="#" id="routerowdel0"><i class="fa fa-trash"></i></a>';
|
||||
|
||||
html += "</td></tr>\n";
|
||||
|
||||
last.after(html);
|
||||
}
|
||||
|
||||
var theForm = document.editIax;
|
||||
/* Insert a iax_setting/iax_value pair of text boxes */
|
||||
(function ($) {
|
||||
|
|
|
@ -7,8 +7,9 @@
|
|||
<publisher>Alex GP</publisher>
|
||||
<description>SCCP Phone and Extention Manager</description>
|
||||
<menuitems>
|
||||
<sccpsettings sort="1">SCCP Server Config</sccpsettings>
|
||||
<sccp_phone sort="2">SCCP Phones Manager</sccp_phone>
|
||||
<sccpsettings sort="1">Server Config</sccpsettings>
|
||||
<sccp_adv sort="2">System Parameters</sccp_adv>
|
||||
<sccp_phone sort="3">Phones Manager</sccp_phone>
|
||||
</menuitems>
|
||||
<changelog>
|
||||
* Version 13.0.0.1 * - Alfa Release tested on freepbx v.13.0.192.16, v.14.0.1.5
|
||||
|
|
49
page.sccp_adv.php
Normal file
49
page.sccp_adv.php
Normal file
|
@ -0,0 +1,49 @@
|
|||
<?php /* $Id:$ */
|
||||
if (!defined('FREEPBX_IS_AUTH')) { die('No direct script access allowed'); }
|
||||
// License for all code of this FreePBX module can be found in the license file inside the module directory
|
||||
// Copyright 2015 Sangoma Technologies.
|
||||
//
|
||||
// vim: set ai ts=4 sw=4 ft=php:
|
||||
|
||||
// SccpSettings page. Re-written for usage with chan_sccp
|
||||
// AGPL v3 Licened
|
||||
|
||||
// Note that BEFORE THIS IS CALLED, the Sipsettings configPageinit
|
||||
// function is called. This is where you do any changes. The page.foo.php
|
||||
// is only for DISPLAYING things. MVC is a cool idea, ya know?
|
||||
//
|
||||
$spage = FreePBX::create()->Sccp_manager;
|
||||
$display_page = $spage->AdvServerShowPage();
|
||||
$display_info = _("SCCP Advance Server Configuration");
|
||||
|
||||
?>
|
||||
|
||||
<div class="container-fluid">
|
||||
<h1><?php echo $display_info?></h1>
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="fpbx-container">
|
||||
<div class="display no-border">
|
||||
<div class="nav-container">
|
||||
<div class="scroller scroller-left"><i class="glyphicon glyphicon-chevron-left"></i></div>
|
||||
<div class="scroller scroller-right"><i class="glyphicon glyphicon-chevron-right"></i></div>
|
||||
<div class="wrapper">
|
||||
<ul class="nav nav-tabs list" role="tablist">
|
||||
<?php foreach($display_page as $key => $page) { ?>
|
||||
<li data-name="<?php echo $key?>" class="change-tab <?php echo $key == 'general' ? 'active' : ''?>"><a href="#<?php echo $key?>" aria-controls="<?php echo $key?>" role="tab" data-toggle="tab"><?php echo $page['name']?></a></li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-content display">
|
||||
<?php foreach($display_page as $key => $page) { ?>
|
||||
<div id="<?php echo $key?>" class="tab-pane <?php echo $key == 'general' ? 'active' : ''?>">
|
||||
<?php echo $page['content']?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
80
views/form.dptemplet.php
Normal file
80
views/form.dptemplet.php
Normal file
|
@ -0,0 +1,80 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
//$list_data = $this->get_DialPlant('dialplan');
|
||||
//print_r($list_data);
|
||||
//$dialFelds = array('match','timeout','line','rewrite','tone');
|
||||
//$dialFelds = array('match','timeout','User','rewrite','tone');
|
||||
$dialFelds = array('match','timeout','rewrite','tone');
|
||||
$dev_id = '*new*';
|
||||
if (!empty($_REQUEST['extdisplay'])) {
|
||||
$dev_id = $_REQUEST['extdisplay'];
|
||||
}
|
||||
if ($dev_id != '*new*') {
|
||||
$list_data= $this->get_DialPlant($dev_id );
|
||||
$data_s= '';
|
||||
foreach ($list_data['template'] as $key => $value) {
|
||||
foreach ($dialFelds as $fld) {
|
||||
if (isset($value[$fld])) {
|
||||
$data_s .=(string)$value[$fld];
|
||||
}
|
||||
$data_s .= '/';
|
||||
}
|
||||
$data_s = substr($data_s, 0, -1);
|
||||
$data_s .= ';';
|
||||
}
|
||||
$data_s = substr($data_s, 0, -1);
|
||||
$def_val['dialtemplete'] = array("keyword" => 'dialtemplete', "data" => $data_s, "seq" => "99");
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<form autocomplete="off" name="frm_editdialtemplet" id="frm_editbutons" class="fpbx-submit" action="" method="post" data-id="dial_templet">
|
||||
|
||||
<input type="hidden" name="idtemplet" value="<?php echo $dev_id;?>">
|
||||
<input type="hidden" name="Submit" value="Submit">
|
||||
<?php
|
||||
if ($dev_id == '*new*') {
|
||||
echo $this->ShowGroup('sccp_dp_new_templet',0,'sccp_dial',$def_val);
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading"><?php echo _("Dial Plan Help");?>
|
||||
<a data-toggle="collapse" href="#pathelp"><i class="fa fa-plus pull-right"></i></a>
|
||||
</div>
|
||||
<div class="panel-body collapse" id="pathelp">
|
||||
<p> <?php echo _("Specifies a pattern to match dialed digits against. Note: TEMPLATE must be in uppercase.");?> </p>
|
||||
<h4><?php echo _("Rules:");?></h4>
|
||||
<table class="table">
|
||||
<tr><td><strong><?php echo _("match:");?> </strong></td><td><?php echo _("Pattern to match, consists of one or more elements");?></td></tr>
|
||||
<tr><td><strong>0 1 2 3 4 5 6 7 8 9</strong></td><td><?php echo _("Match digit");?></td></tr>
|
||||
<tr><td><strong>.</strong></td><td><?php echo _("Match one digit, # or *");?></td></tr>
|
||||
<tr><td><strong>*</strong></td><td><?php echo _("Match zero or more digits, # or *");?></td></tr>
|
||||
<tr><td><strong>\*</strong></td><td><?php echo _("Match a literal *");?></td></tr>
|
||||
<tr><td><strong>,</strong></td><td><?php echo _("Play secondary dial-tone specified by tone");?></td></tr>
|
||||
<tr><td><strong><?php echo _("timeout:");?></strong></td><td><?php echo _("Number of seconds to wait for more digits if this pattern matches");?></td></tr>
|
||||
<tr><td><strong><?php echo _("line:");?></strong></td><td><?php echo _("Only apply template to the specified line (optional)");?></td></tr>
|
||||
<tr><td><strong><?php echo _("rewrite:");?></strong></td><td><?php echo _("Rewrite the matched digits before dialing, consists of one or more elements (optional)");?></td></tr>
|
||||
<tr><td><strong>0 1 2 3 4 5 6 7 8 9</strong></td><td><?php echo _("Replace with digit");?></td></tr>
|
||||
<tr><td><strong>%0</strong></td><td><?php echo _("The entire match");?></td></tr>
|
||||
<tr><td><strong>%1 %2 %3 %4 %5</strong></td><td><?php echo _("Replace with group of digits matched, grouping is done by consecutive literal digit or . elements");?></td></tr>
|
||||
<tr><td><strong>%%</strong></td><td><?php echo _("A literal %");?></td></tr>
|
||||
<tr><td><strong>.</strong></td><td><?php echo _("Each . is replaced by the digit that was matched by the corresponding . in the pattern");?></td></tr>
|
||||
<tr><td><strong><?php echo _("tone:");?></strong></td><td><?php echo _("Secondary dial-tone to play when a , is matched, up to 3 can be specified (optional)");?></td></tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<?php
|
||||
// echo $this->ShowGroup('sccp_dp_new_templet',0,'sccp_dial',$def_val);
|
||||
echo $this->ShowGroup('sccp_dp_templet',0,'sccp_dial',$def_val);
|
||||
?>
|
||||
</form>
|
|
@ -2,8 +2,10 @@
|
|||
/*
|
||||
* IE - Text Input
|
||||
* IED - Text Input Dynamic
|
||||
* ITED- Input Dynamic Table
|
||||
* IS - Radio box
|
||||
* SL - Select element
|
||||
* SLA - Select element (from - data )
|
||||
* Input element Select SLD - Date format
|
||||
* SLZ - Time Zone
|
||||
* SLZN - Time Zone List
|
||||
|
@ -157,7 +159,6 @@ foreach ($items as $child) {
|
|||
|
||||
echo '<!-- Begin '.$child->label.' -->';
|
||||
?>
|
||||
<!--Local Networks-->
|
||||
<div class="element-container">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
@ -345,7 +346,7 @@ foreach ($items as $child) {
|
|||
* Input element Select SLS - System Language
|
||||
*/
|
||||
|
||||
if ($child['type'] == 'SLS' || $child['type'] == 'SLT') {
|
||||
if ($child['type'] == 'SLS' || $child['type'] == 'SLT' || $child['type'] == 'SLA') {
|
||||
// $value = $child -> select;
|
||||
$res_n = (string)$child ->name;
|
||||
$res_id = $npref.$res_n;
|
||||
|
@ -356,6 +357,21 @@ foreach ($items as $child) {
|
|||
if ($child['type'] == 'SLT') {
|
||||
$select_opt= $tftp_lang;
|
||||
}
|
||||
|
||||
if ($child['type'] == 'SLA') {
|
||||
$select_opt ='';
|
||||
if (!empty($fvalues[$res_n])) {
|
||||
if (!empty($fvalues[$res_n]['data'])) {
|
||||
$res_value = explode(';', $fvalues[$res_n]['data']);
|
||||
}
|
||||
if (empty($res_value)) {
|
||||
$res_value = array((string) $child->default);
|
||||
}
|
||||
foreach ($res_value as $key) {
|
||||
$select_opt[$key]= $key;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($child->class)) {
|
||||
$child->class = 'form-control';
|
||||
|
@ -410,7 +426,6 @@ foreach ($items as $child) {
|
|||
echo '<!-- Begin '.$child->label.' -->';
|
||||
|
||||
?>
|
||||
<!--System Language-->
|
||||
<div class="element-container">
|
||||
<div class="row"> <div class="form-group">
|
||||
|
||||
|
@ -445,7 +460,6 @@ foreach ($items as $child) {
|
|||
<span id="<?php echo $res_id;?>-help" class="help-block fpbx-help-block"><?php echo _($child->help);?></span>
|
||||
</div></div>
|
||||
</div>
|
||||
<!--END System Language-->
|
||||
<?php
|
||||
echo '<!-- END '.$child->label.' -->';
|
||||
}
|
||||
|
@ -517,6 +531,112 @@ foreach ($items as $child) {
|
|||
echo '<!-- END '.$child->label.' -->';
|
||||
|
||||
}
|
||||
if ($child['type'] == 'ITED') {
|
||||
$res_input = '';
|
||||
$res_name = '';
|
||||
$res_na = (string)$child->name;
|
||||
|
||||
// $res_value
|
||||
$lnhtm = '';
|
||||
$res_id = $napref.$child->name;
|
||||
$i = 0;
|
||||
|
||||
if (!empty($fvalues[$res_na])) {
|
||||
if (!empty($fvalues[$res_na]['data'])) {
|
||||
$res_value = explode(';', $fvalues[$res_na]['data']);
|
||||
}
|
||||
}
|
||||
if (empty($res_value)) {
|
||||
$res_value = array((string) $child->default);
|
||||
// $res_value = explode('/', (string) $child->default);
|
||||
}
|
||||
|
||||
echo '<!-- Begin '.$res_id.' -->';
|
||||
?>
|
||||
<table class="table table-striped" id="dp-table-<?php echo $res_id;?>">
|
||||
|
||||
<?php
|
||||
foreach ($res_value as $dat_v) {
|
||||
echo '<tr data-nextid="'.($i+1).'" class="'.$res_id.'" id="'.$res_id.'-row-'.($i).'"> ';
|
||||
if (!empty($child->label)) {
|
||||
echo '<td class=""> <div class="input-group">'.$child->label.'</div></td>';
|
||||
}
|
||||
|
||||
$res_vf = explode('/', $dat_v);
|
||||
$i2 = 0;
|
||||
|
||||
foreach ($child->xpath('element') as $value) {
|
||||
$fields_id = (string)strtolower($value['field']);
|
||||
$res_n = $res_id.'['.$i.']['.$fields_id.']';
|
||||
$res_ni = $res_id.'_'.$i.'_'.$fields_id;
|
||||
|
||||
$opt_at[$fields_id]['display_prefix']=(string)$value['display_prefix'];
|
||||
$opt_at[$fields_id]['display_sufix']=(string)$value['display_sufix'];
|
||||
|
||||
if (empty($value->options->class)) {
|
||||
$opt_at[$fields_id]['options']['class']='form-control';
|
||||
}
|
||||
$opt_at[$fields_id]['type']=(string)$value['type'];
|
||||
$res_opt['addon'] ='';
|
||||
if (isset($value->options)){
|
||||
foreach ($value->options ->attributes() as $optkey =>$optval){
|
||||
$opt_at[$fields_id]['options'][$optkey]=(string)$optval;
|
||||
$res_opt['addon'] .=' '.$optkey.'="'.$optval.'"';
|
||||
}
|
||||
}
|
||||
|
||||
echo '<td class="">';
|
||||
$res_opt['inp_st'] = '<div class="input-group"> <span class="input-group-addon" id="basep_'.$res_n.'">'.$opt_at[$fields_id]['display_prefix'].'</span>';
|
||||
$res_opt['inp_end'] = '<span class="input-group-addon" id="bases_'.$res_n.'">'.$opt_at[$fields_id]['display_sufix'].'</span></div>';
|
||||
switch ($value['type']){
|
||||
case 'date':
|
||||
echo $res_opt['inp_st'].'<input type="date" name="'. $res_n.'" value="'.$res_vf[$i2].'"'.$res_opt['addon']. '>'.$res_opt['inp_end'];
|
||||
break;
|
||||
case 'number':
|
||||
echo $res_opt['inp_st'].'<input type="number" name="'. $res_n.'" value="'.$res_vf[$i2].'"'.$res_opt['addon']. '>'.$res_opt['inp_end'];
|
||||
break;
|
||||
case 'input':
|
||||
echo $res_opt['inp_st'].'<input type="text" name="'. $res_n.'" value="'.$res_vf[$i2].'"'.$res_opt['addon']. '>'.$res_opt['inp_end'];
|
||||
break;
|
||||
case 'title':
|
||||
if ($i > 0 ) {
|
||||
break;
|
||||
}
|
||||
case 'label':
|
||||
$opt_at[$fields_id]['data'] = (string)$value;
|
||||
echo '<label '.$res_opt['addon'].' >'.(string)$value.'</label>';
|
||||
break;
|
||||
case 'select':
|
||||
echo $res_opt['inp_st'].'<select name="'.$res_n.'" id="' . $res_n . '"'. $res_opt['addon'].'>';
|
||||
$opt_at[$fields_id]['data']='';
|
||||
foreach ($value->xpath('data') as $optselect ){
|
||||
$opt_at[$fields_id]['data'].= (string)$optselect.';';
|
||||
echo '<option value="' . $optselect. '"';
|
||||
if (strtolower((string)$optselect) == strtolower((string)$res_vf[$i2])) {
|
||||
echo ' selected="selected"';
|
||||
}
|
||||
echo '>' . (string)$optselect. '</option>';
|
||||
}
|
||||
echo '</select>'.$res_opt['inp_end'];
|
||||
break;
|
||||
}
|
||||
echo '</td>';
|
||||
$i2 ++;
|
||||
|
||||
}
|
||||
echo '<td><input type="button" id="'.$res_id.'-btn" data-id="'.($i).'" data-for="'.$res_id.'" data-json="'.bin2hex(json_encode($opt_at)).'" class="table-js-add" value="+" />';
|
||||
if ($i > 0 ) {
|
||||
echo '<input type="button" id="'.$res_id.'-btndel" data-id="'.($i).'" data-for="'.$res_id.'" class="table-js-del" value="-" />';
|
||||
}
|
||||
|
||||
echo '</td></tr>';
|
||||
$i++;
|
||||
}
|
||||
echo '</table>';
|
||||
echo '<!-- END '.$res_id.' -->';
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -48,9 +48,9 @@
|
|||
function DispayDeviceActionsKeyFormatter(value, row, index) {
|
||||
var exp_model = '';
|
||||
exp_model += '<a href="?display=sccp_phone&tech_hardware=cisco&id=' + row['name'] + '"><i class="fa fa-pencil"></i></a> \n';
|
||||
exp_model += '<a href="#delete_hardware" onclick="delete_oncliсk(this, "'+row['name']+'")"><i class="fa fa-trash"></i></a>';
|
||||
exp_model += '</a> <a class="btn-item-delete" data-for="hardware" data-id="' + row['name'] + '"><i class="fa fa-trash"></i></a>';
|
||||
return exp_model;
|
||||
}
|
||||
}
|
||||
|
||||
function LineFormatter(value, row, index) {
|
||||
var data = value.split(";");
|
||||
|
|
|
@ -453,7 +453,16 @@ and open the template in the editor.
|
|||
<class>form-control</class>
|
||||
<help>Music Class: Available MOH Classes. These are the MOH classes listed in your current server.</help>
|
||||
</item>
|
||||
<item type="IS" id="7" seq="98"><name>autoselectline_enabled</name> <label>Autoselect Line</label>
|
||||
<item type="SLA-disabled" id="6"><label>Default Dial Plan</label>
|
||||
<name>dial_templet</name>
|
||||
<default>none</default>
|
||||
<select></select>
|
||||
<class>sccp-custom</class>
|
||||
<help>Help.</help>
|
||||
</item>
|
||||
<item type="IS" id="7" seq="98">
|
||||
<name>autoselectline_enabled</name>
|
||||
<label>Autoselect Line</label>
|
||||
<default>no</default>
|
||||
<button value="yes">Enabled</button>
|
||||
<button value="no">Disabled</button>
|
||||
|
@ -842,5 +851,58 @@ and open the template in the editor.
|
|||
|
||||
|
||||
</page_group>
|
||||
|
||||
<page_group name="sccp_dp_new_templet">
|
||||
<item type="IE" id="1" seq="99"><label>Templet Name</label>
|
||||
<input>
|
||||
<name>dialtemplete_name</name>
|
||||
<default></default>
|
||||
<class>form-control</class>
|
||||
</input>
|
||||
<help>Help.</help>
|
||||
</item>
|
||||
|
||||
</page_group>
|
||||
<page_group name="sccp_dp_templet">
|
||||
<label>Device Templet Function</label>
|
||||
<item type="ITED" id="1" seq="0">
|
||||
<name>dialtemplete</name>
|
||||
<default>*/10/*</default>
|
||||
<element1 type="title" field="title"><options class="form-control control-label"/>title</element1>
|
||||
<element type="input" value="none" field="match" display_prefix="(" display_sufix=")"><options class="form-control dpt-title" placeholder="Pattern to match"/></element>
|
||||
<element type="number" value="none" field="timeout" display_prefix="[" display_sufix="]"><options min="0" max="30" class="form-control dpt-title" placeholder="Time wait" /></element>
|
||||
<element1 type="label" field="label1"><options class="form-control control-label"/>text1</element1>
|
||||
<element type="input" value="none" field="rewrite" display_prefix="(" display_sufix=")"><options class="form-control dpt-title" placeholder="Rewrite the matched"/></element>
|
||||
<element type="select" value="none" field="tone">
|
||||
<options class="form-control dpt-title" />
|
||||
<data>empty</data>
|
||||
<data>Bellcore-Alerting</data>
|
||||
<data>Bellcore-Inside</data>
|
||||
<data>Bellcore-Outside</data>
|
||||
<data>Bellcore-Busy</data>
|
||||
<data>Bellcore-BusyVerify</data>
|
||||
<data>Bellcore-Reorder</data>
|
||||
<data>Bellcore-CallWaiting</data>
|
||||
<data>Bellcore-Hold</data>
|
||||
<data>Bellcore-Reminder</data>
|
||||
<data>Bellcore-Confirmation</data>
|
||||
<data>Bellcore-Stutter</data>
|
||||
<data>Bellcore-Permanent</data>
|
||||
<data>Bellcore-None</data>
|
||||
<data>Cisco-Zip</data>
|
||||
<data>Cisco-ZipZip</data>
|
||||
<data>Cisco-BeepBonk</data>
|
||||
<data>Bellcore-dr1</data>
|
||||
<data>Bellcore-dr2</data>
|
||||
<data>Bellcore-dr3</data>
|
||||
<data>Bellcore-dr4</data>
|
||||
<data>Bellcore-dr5</data>
|
||||
<data>Bellcore-dr6</data>
|
||||
<data>CallWaiting-2</data>
|
||||
<data>CallWaiting-3</data>
|
||||
<data>CallWaiting-4</data>
|
||||
</element>
|
||||
<help>Alow network settings. Blank fields will be ignored used Network 0.0.0.0.</help>
|
||||
</item>
|
||||
|
||||
</page_group>
|
||||
</root>
|
||||
|
|
|
@ -5,6 +5,14 @@
|
|||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
$data = 'none;';
|
||||
foreach ($this->get_DP_list() as $value) {
|
||||
$data .= $value['id'].';';
|
||||
}
|
||||
if (strlen($data) >0 ){
|
||||
$data = substr ($data,0,-1);
|
||||
}
|
||||
$this->sccpvalues['dial_templet'] = array('keyword' => 'dial_templet', 'data' => $data, 'type' => '10', 'seq' => '90');
|
||||
?>
|
||||
<form autocomplete="off" name="frm_device" id="frm_device" class="fpbx-submit" action="" method="post">
|
||||
<input type="hidden" name="category" value="deviceform">
|
||||
|
@ -14,6 +22,5 @@
|
|||
echo $this->ShowGroup('sccp_dev_config',1);
|
||||
echo $this->ShowGroup('sccp_dev_url',1);
|
||||
echo $this->ShowGroup('sccp_hotline_config',1);
|
||||
|
||||
?>
|
||||
</form>
|
||||
|
|
42
views/server.dialtemplet.php
Normal file
42
views/server.dialtemplet.php
Normal file
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
// vim: set ai ts=4 sw=4 ft=phtml:
|
||||
//print_r($this->get_DP_list());
|
||||
//print_r($this->get_DialPlant('dialplan'));
|
||||
?>
|
||||
<div class="fpbx-container container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="display no-border">
|
||||
<h1><?php echo _("Cisco Dial Templet") ?></h1>
|
||||
<div id="toolbar-sccp-dialtemplet">
|
||||
<a class="btn btn-default" href="config.php?display=sccp_adv&tech_hardware=dialplan&extdisplay=*new*"><i class="fa fa-plus"> </i><?php echo _("Add Dialplan") ?></a>
|
||||
<button id="remove-sccp-dialtemplet" class="btn btn-danger btn-remove" data-type="dialtemplet" data-section="sccp-dialtemplet" disabled>
|
||||
<i class="glyphicon glyphicon-remove"></i> <span><?php echo _('Delete') ?></span>
|
||||
</button>
|
||||
</div>
|
||||
<table data-cookie="true" data-cookie-id-table="sccp-dialtemplet-table" data-url="ajax.php?module=sccp_manager&command=getDialTemplete" data-cache="false" data-show-refresh="true" data-toolbar="#toolbar-dialtemplet" 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-dialtemplet" data-id="id">
|
||||
<thead>
|
||||
<tr>
|
||||
<!-- <th data-checkbox="true"></th> -->
|
||||
<th data-sortable="true" data-field="id"><?php echo _('Templete name') ?></th>
|
||||
<th data-field="actions" data-formatter="DispayDPActionsKeyFormatter"><?php echo _('Actions') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
function DispayDPActionsKeyFormatter(value, row, index) {
|
||||
var exp_model = '';
|
||||
exp_model += '<a href="?display=sccp_adv&tech_hardware=dialplan&extdisplay=' + row['id'] + '"><i class="fa fa-pencil"></i></a> \n';
|
||||
exp_model += '</a> <a class="btn-item-delete" data-for="dialplan" data-id="' + row['id'] + '"><i class="fa fa-trash"></i></a>';
|
||||
return exp_model;
|
||||
}
|
||||
</script>
|
|
@ -164,10 +164,8 @@ $keynamearray = array('onhook' => array(sname => 'ONHOOK', name =>'Display On
|
|||
function DispayActionsKeyFormatter(value, row, index) {
|
||||
var exp_model = '';
|
||||
if (row['softkeys'] !== 'default') {
|
||||
// exp_model += '<a href="#edit_softkeys" class="btn btn-info" onclick="load_oncliсk(this, "'+row['softkeys']+'")" data-toggle="modal" data-target=".edit_new_keyset"><i class="fa fa-pencil"></i></a>';
|
||||
// exp_model += '<a href="#delete_softkeys" class="btn btn-danger" onclick="delete_oncliсk(this,"'+row['softkeys']+'")"><i class="fa fa-trash"></i></a>';
|
||||
exp_model += '<a href="#edit_softkeys" onclick="load_oncliсk(this, "'+row['softkeys']+'")" data-toggle="modal" data-target=".edit_new_keyset"><i class="fa fa-pencil"></i></a> ';
|
||||
exp_model += '<a href="#delete_softkeys" onclick="delete_oncliсk(this,"'+row['softkeys']+'")"><i class="fa fa-trash"></i></a>';
|
||||
exp_model += '</a> <a class="btn-item-delete" data-for="softkeys" data-id="' + row['softkeys'] + '"><i class="fa fa-trash"></i></a>';
|
||||
}
|
||||
return exp_model;
|
||||
}
|
||||
|
|
|
@ -218,9 +218,8 @@
|
|||
function DispayActionsModelFormatter(value, row, index) {
|
||||
var exp_model = '';
|
||||
// exp_model += '<a href="#edit_model" class="btn btn-info" onclick="load_model(this, "'+row['model']+'")" data-toggle="modal"><i class="fa fa-pencil"></i></a>';
|
||||
// exp_model += '<a href="#delete_model" class="btn btn-danger" onclick="delete_oncliсk(this, "'+row['model']+'")"><i class="fa fa-trash"></i></a>';
|
||||
exp_model += '<a href="#edit_model" onclick="load_model(this, "'+row['model']+'")" data-toggle="modal"><i class="fa fa-pencil"></i></a> ';
|
||||
exp_model += '<a href="#delete_model" onclick="delete_oncliсk(this, "'+row['model']+'")"><i class="fa fa-trash"></i></a>';
|
||||
exp_model += '</a> <a class="btn-item-delete" data-for="model" data-id="' + row['model'] + '"><i class="fa fa-trash"></i></a>';
|
||||
return exp_model;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue