diff --git a/README.ru.md b/README.ru.md index 4121720..d2f0487 100644 --- a/README.ru.md +++ b/README.ru.md @@ -5,7 +5,7 @@ * [Installation](https://github.com/PhantomVl/sccp_manager#installation) * [Prerequisites](https://github.com/PhantomVl/sccp_manager#prerequisites) - * [Links](https://github.com/PhantomVl/sccp_manager/#link), + * [Links](https://github.com/PhantomVl/sccp_manager#link) * [Wiki](https://github.com/PhantomVl/sccp_manager/wiki) ## Link diff --git a/Sccp_manager.class.php b/Sccp_manager.class.php index c281b25..f8cce61 100644 --- a/Sccp_manager.class.php +++ b/Sccp_manager.class.php @@ -93,7 +93,9 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { private $pagedata = null; private $sccp_driver_ver = '11.3'; private $tftpLang = array(); - private $hint_context = '@ext-local'; /// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Get it from Config !!! +// private $hint_context = '@ext-local'; /// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Get it from Config !!! + private $hint_context = array('default' => '@ext-local'); /// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Get it from Config !!! + private $val_null = 'NONE'; /// REPLACE to null Field public $sccp_model_list = array(); private $cnf_wr = null; @@ -360,8 +362,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { $request = $_REQUEST; $action = !empty($request['action']) ? $request['action'] : ''; - if (!empty(($this->sccpvalues['displayconfig']))) { - if (!empty(($this->sccpvalues['displayconfig']['data'] == 'sccpsimple'))) { + if (!empty($this->sccpvalues['displayconfig'])) { + if (!empty($this->sccpvalues['displayconfig']['data']) && ($this->sccpvalues['displayconfig']['data'] == 'sccpsimple')) { $this->pagedata = array( "general" => array( "name" => _("General SCCP Settings"), @@ -1061,7 +1063,7 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { $btn_opt = (string) $get_settings['button' . $it . '_line']; $db_res = $this->dbinterface->get_db_SccpTableData('SccpExtension', array('name' => $btn_opt)); $btn_n = $db_res[0]['label']; - $btn_opt .= ',' . $btn_opt . $this->hint_context; + $btn_opt .= ',' . $btn_opt . $this->hint_context['default']; break; case 'speeddial': if (!empty($get_settings['button' . $it . '_input'])) { @@ -1081,7 +1083,8 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { $btn_n = $get_settings['button' . $it . '_hline'] . '!silent'; $btn_opt = ''; } else { - $btn_opt .= ',' . $get_settings['button' . $it . '_hline'] . $this->hint_context; +// $btn_opt .= ',' . $get_settings['button' . $it . '_hline'] . $this->hint_context['default']; + $btn_opt .= ',' . $get_settings['button' . $it . '_hline']; } } } @@ -1503,7 +1506,13 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { } } } - + + $hint = $this->srvinterface->sccp_list_hints(); + foreach ($hint as $key => $value) { + if ($this->hint_context['default'] != $value) { + $this->hint_context[$key] = $value; + } + } } /* @@ -1790,6 +1799,33 @@ class Sccp_manager extends \FreePBX_Helpers implements \BMO { return $raw_settings; } + function get_hint_info($get = "all", $format_list = "all", $filter = array()) { + $res = array(); + $default_hint = '@ext-local'; +// get all hints [101@ext-local] => 101@ext-local + $tmp_data = $this->srvinterface->sccp_list_all_hints(); + foreach ($tmp_data as $value) { +/* !TODO!: Add Hint Filtred List */ + $res[$value] = array('hint' => $value, 'name' => before('@', $value), 'label' => $value ); + } +// Update info from sccp_db + $tmp_data = $this->dbinterface->get_db_SccpTableData('SccpExtension'); + foreach ($tmp_data as $value) { + $name_l = $value['name']; + if (!empty($res[$name_l.$default_hint])) { + $res[$name_l.$default_hint]['name'] = $name_l; + $res[$name_l.$default_hint]['label'] = $value['label']; + } else { // if not exist in system hints ..... ??????? + $res[$name_l.$default_hint] = array('hint' => $name_l.$default_hint, 'name' => $name_l, 'label' => $value['label'] ); + } + + } +// Update info from sip DB +/* !TODO!: Update Hint info from sip DB ??? */ + + return $res; + } + function getIP_information() { $interfaces['auto'] = array('0.0.0.0', 'All', '0'); diff --git a/Sccp_manager.inc/srvinterface.class.php b/Sccp_manager.inc/srvinterface.class.php index 355eeb3..4e9207e 100644 --- a/Sccp_manager.inc/srvinterface.class.php +++ b/Sccp_manager.inc/srvinterface.class.php @@ -26,6 +26,10 @@ class srvinterface { Core Access Function */ + +/* + * Replace or dublicate to AMI interface + */ public function sccp_core_commands($params = array()) { global $astman; $cmd_list = array('get_softkey' => array('cmd' => "sccp show softkeyssets", 'param' => ''), @@ -118,8 +122,20 @@ class srvinterface { /* * A function should be used in the form of buttons for getting all hint. Not working. I don't know how to use properly. */ - public function sccp_list_hints() { + $hint_key = array(); + $hint_all = $this->sccp_list_all_hints(); + foreach ($hint_all as $value) { + $res = $this->loc_after('@', $value); +// array_search($res, $hint_key)) != NULL) + if (!isset($hint_key[$res])) { + $hint_key[$res] = '@'.$res; + } + } + return $hint_key; + } + + public function sccp_list_all_hints() { $ast_out = $this->sccp_core_commands(array('cmd' => 'get_hints')); $ast_out = preg_split("/[\n]/", $ast_out['data']); $ast_key = array(); @@ -379,7 +395,14 @@ class srvinterface { return strpos($haystack, $needles); } return FALSE; -} + } + + private function loc_after($value, $inthat) + { + if (!is_bool(strpos($inthat, $value))) + return substr($inthat, strpos($inthat, $value) + strlen($value)); + } + } diff --git a/views/form.buttons.php b/views/form.buttons.php index 7164f13..f4280c5 100644 --- a/views/form.buttons.php +++ b/views/form.buttons.php @@ -15,8 +15,9 @@ $buttons_type= array("empty","line","silent","monitor","speeddial","feature","a $feature_list= array('parkinglot'=>'Park Slots','monitor'=> "Record Calls",'devstate'=> "Change Status"); $lines_list = $this->dbinterface->get_db_SccpTableData('SccpExtension'); -$hint_list = $this->dbinterface->get_db_SccpTableData('SccpExtension'); -//$hint_list = $this->sccp_list_hints(); +//$hint_list = $this->dbinterface->get_db_SccpTableData('SccpExtension'); +$hint_list = $this->get_hint_info(); + $line_id =0; $max_buttons =56; $show_buttons =1; @@ -84,6 +85,7 @@ if (!empty($_REQUEST['new_id'])) { $defaul_tv = (empty($db_buttons[$line_id])) ? "empty": $db_buttons[$line_id]['type']; $defaul_btn = (empty($db_buttons[$line_id])) ? "": $db_buttons[$line_id]['name']; $defaul_opt = (empty($db_buttons[$line_id])) ? array(''): explode(',',$db_buttons[$line_id]['options']); + print_r($defaul_opt); $show_form_mode = $defaul_tv; @@ -107,6 +109,7 @@ if (!empty($_REQUEST['new_id'])) { if ($defaul_tv == "feature") { $defaul_ftr = $defaul_opt[0]; $defaul_fcod = (empty($defaul_opt[1])) ? '': $defaul_opt[1]; + print_r($defaul_fcod); } foreach ($defaul_opt as $data_i) { if (strpos($data_i,'@') >0) { @@ -115,7 +118,10 @@ if (!empty($_REQUEST['new_id'])) { if ($defaul_btn == $defaul_opt[0]) { $show_form_mode = 'line'; $defaul_tv = 'monitor'; + } else { + $defaul_btn = $data_i; } + } } @@ -187,8 +193,8 @@ if (!empty($_REQUEST['new_id'])) { echo ''; echo ''; @@ -202,7 +208,7 @@ if (!empty($_REQUEST['new_id'])) {
'; + echo ''; ?>
diff --git a/views/server.info.php b/views/server.info.php index 0063d24..d924152 100644 --- a/views/server.info.php +++ b/views/server.info.php @@ -29,8 +29,9 @@ if (!empty($this->sccpvalues['tftp_rewrite'])) { $info['Сompatible'] = array('Version' => $this->srvinterface->get_compatible_sccp(), 'about'=> ''); //print_r("
Request:
");
  //$asss = $this->extconfigs->validate_init_path($this->sccppath["asterisk"],$this->sccpvalues,$driver_ver);
- //print_r($asss);
- //print("
"); + //$hint_list = $this->get_hint_info(); + //print_r($hint_list); +//print(""); // $lang_arr = $this->extconfigs->getextConfig('sccp_lang','sk_SK'); // print_r('
');